]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/infocmp.c
ncurses 6.2 - patch 20210323
[ncurses.git] / progs / infocmp.c
index 82c48419a047f6ddce2ff02d350c103b604b7ad7..a49cbf6a4cb7b571022eaaeb1e694c9a2399e2c4 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +43,7 @@
 
 #include <dump_entry.h>
 
-MODULE_ID("$Id: infocmp.c,v 1.143 2017/04/05 09:27:51 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.147 2021/03/20 18:07:41 tom Exp $")
 
 #define MAX_STRING     1024    /* maximum formatted string */
 
@@ -93,7 +94,7 @@ typedef struct {
 static ENTERED *entered;
 
 #undef ExitProgram
-static void ExitProgram(int code) GCC_NORETURN;
+static GCC_NORETURN void ExitProgram(int code);
 /* prototype is to get gcc to accept the noreturn attribute */
 static void
 ExitProgram(int code)
@@ -834,6 +835,8 @@ analyze_string(const char *name, const char *cap, TERMTYPE2 *tp)
            char *cp = tp->Strings[i];
 
            /* don't use function-key capabilities */
+           if (strnames[i] == NULL)
+               continue;
            if (strnames[i][0] == 'k' && strnames[i][1] == 'f')
                continue;
 
@@ -1193,8 +1196,9 @@ usage(void)
        DATA("Options:")
     };
 #undef DATA
+    /* length is given here so the compiler can make everything readonly */
 #define DATA(s) s
-    static const char options[][45] =
+    static const char options[][46] =
     {
        "  -0    print single-row"
        ,"  -1    print single-column"
@@ -1834,8 +1838,8 @@ main(int argc, char *argv[])
                                   tname[termcount]);
 
                status = _nc_read_entry2(tname[termcount],
-                                       tfile[termcount],
-                                       &entries[termcount].tterm);
+                                        tfile[termcount],
+                                        &entries[termcount].tterm);
            }
 
            if (status <= 0) {