]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/dump_entry.c
ncurses 5.9 - patch 20121208
[ncurses.git] / progs / dump_entry.c
index 354901ebd4eb49e9ee4efb1dd5bc9b6a509abb76..31deedb2de18f48c8b702f895405c1fe9296ac38 100644 (file)
@@ -39,7 +39,7 @@
 #include "termsort.c"          /* this C file is generated */
 #include <parametrized.h>      /* so is this */
 
-MODULE_ID("$Id: dump_entry.c,v 1.99 2012/03/10 23:20:35 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.101 2012/10/27 19:45:17 tom Exp $")
 
 #define INDENT                 8
 #define DISCARD(string) string = ABSENT_STRING
@@ -100,6 +100,13 @@ static const char *separator, *trailer;
 #define StrIndirect(j)  ((sortmode == S_NOSORT) ? (j) : str_indirect[j])
 #endif
 
+static void
+failed(const char *s)
+{
+    perror(s);
+    ExitProgram(EXIT_FAILURE);
+}
+
 static void
 strncpy_DYN(DYNBUF * dst, const char *src, size_t need)
 {
@@ -107,6 +114,8 @@ strncpy_DYN(DYNBUF * dst, const char *src, size_t need)
     if (want > dst->size) {
        dst->size += (want + 1024);     /* be generous */
        dst->text = typeRealloc(char, dst->size, dst->text);
+       if (dst->text == 0)
+           failed("strncpy_DYN");
     }
     (void) strncpy(dst->text + dst->used, src, need);
     dst->used += need;
@@ -1187,7 +1196,7 @@ show_entry(void)
      */
     if (outbuf.used != 0) {
        bool infodump = (outform != F_TERMCAP && outform != F_TCONVERR);
-       char delim = infodump ? ',' : ':';
+       char delim = (char) (infodump ? ',' : ':');
        int j;
 
        for (j = (int) outbuf.used - 1; j > 0; --j) {