X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Finfocmp.c;h=8680df35d34f5990063ec05dd7e13d45d4b09b9a;hp=7676c97754d6ecf94f6d68ac8c91a33ab2c322ef;hb=bd7ef7c2309fd00aa4576168c46f557c622cb9c3;hpb=03a795bde58b3280a4e9d80029a3b7fec13c79ad diff --git a/progs/infocmp.c b/progs/infocmp.c index 7676c977..8680df35 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2008 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.91 2007/07/28 23:00:19 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.96 2008/01/19 21:08:07 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -1215,6 +1215,8 @@ dump_termtype(TERMTYPE *term) NUM_STRINGS(term) - STRCOUNT); (void) printf("#endif /* NCURSES_XNAMES */\n"); +#else + (void) term; #endif /* NCURSES_XNAMES */ (void) printf("\t%s\n", R_CURL); } @@ -1261,6 +1263,8 @@ main(int argc, char *argv[]) char **tname = 0; int maxterms; + char **myargv; + char *firstdir, *restdir; int c, i, len; bool formatted = FALSE; @@ -1278,6 +1282,11 @@ main(int argc, char *argv[]) _nc_progname = _nc_rootname(argv[0]); + /* make sure we have enough space to add two terminal entries */ + myargv = typeCalloc(char *, argc + 3); + memcpy(myargv, argv, sizeof(char *) * argc); + argv = myargv; + while ((c = getopt(argc, argv, "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtUuVv:w:x")) != -1) { @@ -1381,7 +1390,6 @@ main(int argc, char *argv[]) case 'r': tversion = 0; - limited = FALSE; break; case 's': @@ -1444,7 +1452,7 @@ main(int argc, char *argv[]) } } - maxterms = (argc + 1 - optind); + maxterms = (argc + 2 - optind); tfile = typeMalloc(path, maxterms); tname = typeCalloc(char *, maxterms); entries = typeCalloc(ENTRY, maxterms); @@ -1486,9 +1494,14 @@ main(int argc, char *argv[]) if (directory) { #if USE_DATABASE - (void) sprintf(tfile[termcount], "%s/%c/%s", +#if MIXEDCASE_FILENAMES +#define LEAF_FMT "%c" +#else +#define LEAF_FMT "%02x" +#endif + (void) sprintf(tfile[termcount], "%s/" LEAF_FMT "/%s", directory, - *argv[optind], argv[optind]); + UChar(*argv[optind]), argv[optind]); if (itrace) (void) fprintf(stderr, "%s: reading entry %s from file %s\n", @@ -1629,6 +1642,7 @@ main(int argc, char *argv[]) file_comparison(argc - optind, argv + optind); #if NO_LEAKS + free(myargv); free(tfile); free(tname); #endif