X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Finfocmp.c;h=7b52dded11c65a40776f9a0047673e75b63533e6;hp=131771724a91bff07a260338a03b791ce955ace9;hb=a3173aa5edbdbc6d617800f81a88a304ac5e053c;hpb=8e25fff6a5f576b6dc35eb02b9783fa58680d07b diff --git a/progs/infocmp.c b/progs/infocmp.c index 13177172..7b52dded 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.107 2011/07/30 21:51:01 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.110 2011/12/17 23:59:50 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -72,6 +72,7 @@ static const char *s_cancel = "NULL"; static const char *tversion; /* terminfo version selected */ static unsigned itrace; /* trace flag for debugging */ static int mwidth = 60; +static int mheight = 65535; static int numbers = 0; /* format "%'char'" to/from "%{number}" */ static int outform = F_TERMINFO; /* output format */ static int sortmode; /* sort_mode */ @@ -795,7 +796,7 @@ file_comparison(int argc, char *argv[]) int i, n; memset(heads, 0, sizeof(heads)); - dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, itrace, FALSE); + dump_init((char *) 0, F_LITERAL, S_TERMINFO, 0, 65535, itrace, FALSE); for (n = 0; n < argc && n < MAXCOMPARE; n++) { if (freopen(argv[n], "r", stdin) == 0) @@ -974,6 +975,7 @@ usage(void) "Usage: infocmp [options] [-A directory] [-B directory] [termname...]" ,"" ,"Options:" + ," -0 print single-row" ," -1 print single-column" ," -K use termcap-names and BSD syntax" ," -C use termcap-names" @@ -1249,6 +1251,23 @@ terminal_env(void) return terminal; } +/* + * Show the databases that infocmp knows about. The location to which it writes is + */ +static void +show_databases(void) +{ + DBDIRS state; + int offset; + const char *path2; + + _nc_first_db(&state, &offset); + while ((path2 = _nc_next_db(&state, &offset)) != 0) { + printf("%s\n", path2); + } + _nc_last_db(); +} + /*************************************************************************** * * Main sequence @@ -1300,8 +1319,13 @@ main(int argc, char *argv[]) while ((c = getopt(argc, argv, - "1A:aB:CcdEeFfGgIiKLlnpqR:rs:TtUuVv:w:x")) != -1) { + "01A:aB:CcDdEeFfGgIiKLlnpqR:rs:TtUuVv:w:x")) != -1) { switch (c) { + case '0': + mwidth = 65535; + mheight = 1; + break; + case '1': mwidth = 0; break; @@ -1330,6 +1354,11 @@ main(int argc, char *argv[]) sortmode = S_TERMCAP; break; + case 'D': + show_databases(); + ExitProgram(EXIT_SUCCESS); + break; + case 'c': compare = C_COMMON; break; @@ -1483,7 +1512,7 @@ main(int argc, char *argv[]) sortmode = S_TERMINFO; /* set up for display */ - dump_init(tversion, outform, sortmode, mwidth, itrace, formatted); + dump_init(tversion, outform, sortmode, mwidth, mheight, itrace, formatted); /* make sure we have at least one terminal name to work with */ if (optind >= argc)