X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Finfocmp.c;h=587cbc3449beee64f18cbc787b21bc8a3c592387;hp=6311a0896e12fa3471e56b1967264fe1d0eac85e;hb=bd0d93918c967f71d8e287fd6714f0b88da820da;hpb=91fa4688e82518794fcf0c32a36f3fcca5e4c2d5 diff --git a/progs/infocmp.c b/progs/infocmp.c index 6311a089..587cbc34 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2014 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 +42,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.122 2012/10/27 19:50:50 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.129 2014/02/01 22:11:03 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -404,7 +404,11 @@ show_comparing(char **names) * macro is used for limit-checks against the symbols that tic uses to omit * the two types of non-standard entry. */ +#if NCURSES_XNAMES #define check_user_definable(n,limit) if (!_nc_user_definable && (n) > (limit)) break +#else +#define check_user_definable(n,limit) if ((n) > (limit)) break +#endif /* * Use these macros to simplify loops on C_COMMON and C_NAND: @@ -784,7 +788,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) const assoc *ap; int tp_lines = tp->Numbers[2]; - if (cap == ABSENT_STRING || cap == CANCELLED_STRING) + if (!VALID_STRING(cap)) return; (void) printf("%s: ", name); @@ -800,12 +804,13 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) for (i = 0; i < STRCOUNT; i++) { char *cp = tp->Strings[i]; - /* don't use soft-key capabilities */ - if (strnames[i][0] == 'k' && strnames[i][0] == 'f') + /* don't use function-key capabilities */ + if (strnames[i][0] == 'k' && strnames[i][1] == 'f') continue; - if (cp != ABSENT_STRING && cp != CANCELLED_STRING && cp[0] && cp - != cap) { + if (VALID_STRING(cp) && + cp[0] != '\0' && + cp != cap) { len = strlen(cp); (void) strncpy(buf2, sp, len); buf2[len] = '\0'; @@ -813,7 +818,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) if (_nc_capcmp(cp, buf2)) continue; -#define ISRS(s) (!strncmp((s), "is", 2) || !strncmp((s), "rs", 2)) +#define ISRS(s) (!strncmp((s), "is", (size_t) 2) || !strncmp((s), "rs", (size_t) 2)) /* * Theoretically we just passed the test for translation * (equality once the padding is stripped). However, there @@ -853,7 +858,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* now check for standard-mode sequences */ if (!expansion && (csi = skip_csi(sp)) != 0 - && (len = strspn(sp + csi, "0123456789;")) + && (len = (strspn) (sp + csi, "0123456789;")) && (len < sizeof(buf3)) && (next = (size_t) csi + len) && ((sp[next] == 'h') || (sp[next] == 'l'))) { @@ -874,7 +879,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) if (!expansion && (csi = skip_csi(sp)) != 0 && sp[csi] == '?' - && (len = strspn(sp + csi + 1, "0123456789;")) + && (len = (strspn) (sp + csi + 1, "0123456789;")) && (len < sizeof(buf3)) && (next = (size_t) csi + 1 + len) && ((sp[next] == 'h') || (sp[next] == 'l'))) { @@ -894,7 +899,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE *tp) /* now check for ECMA highlight sequences */ if (!expansion && (csi = skip_csi(sp)) != 0 - && (len = strspn(sp + csi, "0123456789;")) != 0 + && (len = (strspn) (sp + csi, "0123456789;")) != 0 && (len < sizeof(buf3)) && (next = (size_t) csi + len) && sp[next] == 'm') { @@ -1165,6 +1170,7 @@ usage(void) ," -R subset (see manpage)" ," -T eliminate size limits (test)" ," -U eliminate post-processing of entries" + ," -D print database locations" ," -V print version" #if NCURSES_XNAMES ," -a with -F, list commented-out caps" @@ -1220,7 +1226,7 @@ any_initializer(const char *fmt, const char *type) need = (strlen(entries->tterm.term_names) + strlen(type) + strlen(fmt)); - initializer = (char *) malloc(need); + initializer = (char *) malloc(need + 1); if (initializer == 0) failed("any_initializer"); } @@ -1744,7 +1750,7 @@ main(int argc, char *argv[]) tname[termcount] = argv[optind]; if (directory) { -#if USE_DATABASE +#if NCURSES_USE_DATABASE #if MIXEDCASE_FILENAMES #define LEAF_FMT "%c" #else