X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=progs%2Fdump_entry.c;h=60a3d95670359da88dbf660c21a63328c1281ac5;hb=81c758ae6facb0256dbc8a9d1d93795dd093d683;hp=3efe05f4f550229454e858d5f5c15144b4b80607;hpb=a2016785091d241ca289fbac5b40bfc7f0432737;p=ncurses.git diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 3efe05f4..60a3d956 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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 * @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.167 2017/07/15 21:22:01 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.171 2019/01/21 15:11:51 tom Exp $") #define DISCARD(string) string = ABSENT_STRING #define PRINTF (void) printf @@ -94,7 +94,7 @@ static int indent = 8; #define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T') #endif -#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && OBSOLETE(n)) +#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && (sortmode != S_VARIABLE) && OBSOLETE(n)) #if NCURSES_XNAMES #define BoolIndirect(j) ((j >= BOOLCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : bool_indirect[j])) @@ -530,7 +530,7 @@ fill_spaces(const char *src) for (s = d = 0; src[s] != '\0'; ++s) { if (src[s] == ' ') { if (pass) { - strcpy(&result[d], fill); + _nc_STRCPY(&result[d], fill, need + 1 - d); d += (int) size; } else { need += size; @@ -987,12 +987,12 @@ fmt_entry(TERMTYPE2 *tterm, #undef CUR #define CUR tterm-> if (outform == F_TERMCAP) { - if (termcap_reset != ABSENT_STRING) { - if (init_3string != ABSENT_STRING + if (VALID_STRING(termcap_reset)) { + if (VALID_STRING(init_3string) && !strcmp(init_3string, termcap_reset)) DISCARD(init_3string); - if (reset_2string != ABSENT_STRING + if (VALID_STRING(reset_2string) && !strcmp(reset_2string, termcap_reset)) DISCARD(reset_2string); } @@ -1068,7 +1068,7 @@ fmt_entry(TERMTYPE2 *tterm, buffer[0] = '\0'; if (predval != FAIL) { - if (capability != ABSENT_STRING + if (VALID_STRING(capability) && i + 1 > num_strings) num_strings = i + 1; @@ -1148,8 +1148,7 @@ fmt_entry(TERMTYPE2 *tterm, } } /* e.g., trimmed_sgr0 */ - if (capability != ABSENT_STRING && - capability != CANCELLED_STRING && + if (VALID_STRING(capability) && capability != tterm->Strings[i]) free(capability); } @@ -1320,7 +1319,8 @@ kill_labels(TERMTYPE2 *tterm, int target) for (n = 0; n <= 10; ++n) { _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "lf%d", n); - if ((cap = find_string(tterm, name)) != ABSENT_STRING + cap = find_string(tterm, name); + if (VALID_STRING(cap) && kill_string(tterm, cap)) { target -= (int) (strlen(cap) + 5); ++result; @@ -1345,7 +1345,8 @@ kill_fkeys(TERMTYPE2 *tterm, int target) for (n = 60; n >= 0; --n) { _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "kf%d", n); - if ((cap = find_string(tterm, name)) != ABSENT_STRING + cap = find_string(tterm, name); + if (VALID_STRING(cap) && kill_string(tterm, cap)) { target -= (int) (strlen(cap) + 5); ++result; @@ -1367,7 +1368,7 @@ one_one_mapping(const char *mapping) { bool result = TRUE; - if (mapping != ABSENT_STRING) { + if (VALID_STRING(mapping)) { int n = 0; while (mapping[n] != '\0') { if (isLine(mapping[n]) &&