X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Fdump_entry.c;h=31deedb2de18f48c8b702f895405c1fe9296ac38;hp=354901ebd4eb49e9ee4efb1dd5bc9b6a509abb76;hb=64f44b13d30e0a7bc2921a9d43755423f81564fd;hpb=ba39fbc2e0cee4681395df4079d9e61c27262132 diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 354901eb..31deedb2 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* 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) {