diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-03-02 06:23:57 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-03-02 06:23:57 +0000 |
commit | e52ae7d7cb3b9267a450ee786b056b14391f2f50 (patch) | |
tree | 852bbb003a1438d75ce8016c9feef856d56fd2fd /usr.bin/tic | |
parent | aedffcef562be3c46e9a21641c0a65c968b1d889 (diff) |
ncurses-4.2-990301
Diffstat (limited to 'usr.bin/tic')
-rw-r--r-- | usr.bin/tic/dump_entry.c | 106 | ||||
-rw-r--r-- | usr.bin/tic/dump_entry.h | 6 | ||||
-rw-r--r-- | usr.bin/tic/progs.priv.h | 6 | ||||
-rw-r--r-- | usr.bin/tic/tic.1 | 17 | ||||
-rw-r--r-- | usr.bin/tic/tic.c | 24 |
5 files changed, 87 insertions, 72 deletions
diff --git a/usr.bin/tic/dump_entry.c b/usr.bin/tic/dump_entry.c index b255e1f2c27..84a61b1cfaa 100644 --- a/usr.bin/tic/dump_entry.c +++ b/usr.bin/tic/dump_entry.c @@ -1,7 +1,7 @@ -/* $OpenBSD: dump_entry.c,v 1.3 1999/01/24 19:33:51 millert Exp $ */ +/* $OpenBSD: dump_entry.c,v 1.4 1999/03/02 06:23:55 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 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 * @@ -40,7 +40,7 @@ #include <termsort.c> /* this C file is generated */ #include <parametrized.h> /* so is this */ -MODULE_ID("$From: dump_entry.c,v 1.30 1999/01/24 02:44:40 Jeffrey.C.Honig Exp $") +MODULE_ID("$From: dump_entry.c,v 1.35 1999/03/02 01:23:01 tom Exp $") #define INDENT 8 @@ -76,6 +76,16 @@ static const char *separator, *trailer; #define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T') +#if NCURSES_XNAMES +#define BoolIndirect(j) ((j >= BOOLCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : bool_indirect[j])) +#define NumIndirect(j) ((j >= NUMCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : num_indirect[j])) +#define StrIndirect(j) ((j >= STRCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : str_indirect[j])) +#else +#define BoolIndirect(j) ((sortmode == S_NOSORT) ? (j) : bool_indirect[j]) +#define NumIndirect(j) ((sortmode == S_NOSORT) ? (j) : num_indirect[j]) +#define StrIndirect(j) ((sortmode == S_NOSORT) ? (j) : str_indirect[j]) +#endif + #if NO_LEAKS void _nc_leaks_dump_entry(void) { @@ -460,6 +470,7 @@ int fmt_entry(TERMTYPE *tterm, { int i, j; char buffer[MAX_TERMINFO_LENGTH]; +char * name; int predval, len; int num_bools = 0; int num_values = 0; @@ -483,21 +494,19 @@ bool outcount = 0; column = out_used; force_wrap(); - for (j=0; j < BOOLCOUNT; j++) { - if (sortmode == S_NOSORT) - i = j; - else - i = bool_indirect[j]; + for_each_boolean(j,tterm) { + i = BoolIndirect(j); + name = ExtBoolname(tterm,i,bool_names); if (!version_filter(BOOLEAN, i)) continue; else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(bool_names[i]) && outform != F_LITERAL)) + && (OBSOLETE(name) && outform != F_LITERAL)) continue; predval = pred(BOOLEAN, i); if (predval != FAIL) { - (void) strcpy(buffer, bool_names[i]); + (void) strcpy(buffer, name); if (predval <= 0) (void) strcat(buffer, "@"); else if (i + 1 > num_bools) @@ -509,24 +518,22 @@ bool outcount = 0; if (column != INDENT) force_wrap(); - for (j=0; j < NUMCOUNT; j++) { - if (sortmode == S_NOSORT) - i = j; - else - i = num_indirect[j]; + for_each_number(j,tterm) { + i = NumIndirect(j); + name = ExtNumname(tterm,i,num_names); if (!version_filter(NUMBER, i)) continue; else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(num_names[i]) && outform != F_LITERAL)) + && (OBSOLETE(name) && outform != F_LITERAL)) continue; predval = pred(NUMBER, i); if (predval != FAIL) { if (tterm->Numbers[i] < 0) { - sprintf(buffer, "%s@", num_names[i]); + sprintf(buffer, "%s@", name); } else { - sprintf(buffer, "%s#%d", num_names[i], tterm->Numbers[i]); + sprintf(buffer, "%s#%d", name, tterm->Numbers[i]); if (i + 1 > num_values) num_values = i + 1; } @@ -544,16 +551,14 @@ bool outcount = 0; len++; repair_acsc(tterm); - for (j=0; j < STRCOUNT; j++) { - if (sortmode == S_NOSORT) - i = j; - else - i = str_indirect[j]; + for_each_string(j, tterm) { + i = StrIndirect(j); + name = ExtStrname(tterm,i,str_names); if (!version_filter(STRING, i)) continue; else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(str_names[i]) && outform != F_LITERAL)) + && (OBSOLETE(name) && outform != F_LITERAL)) continue; /* @@ -600,29 +605,29 @@ bool outcount = 0; && i + 1 > num_strings) num_strings = i + 1; if (!VALID_STRING(tterm->Strings[i])) - sprintf(buffer, "%s@", str_names[i]); + sprintf(buffer, "%s@", name); else if (outform == F_TERMCAP || outform == F_TCONVERR) { char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE, numbers); - char *cv = _nc_infotocap(str_names[i], srccap, parametrized[i]); + char *cv = _nc_infotocap(name, srccap, parametrized[i]); if (cv == 0) { if (outform == F_TCONVERR) - sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!", str_names[i], srccap); + sprintf(buffer, "%s=!!! %s WILL NOT CONVERT !!!", name, srccap); else if (suppress_untranslatable) continue; else - sprintf(buffer, "..%s=%s", str_names[i], srccap); + sprintf(buffer, "..%s=%s", name, srccap); } else - sprintf(buffer, "%s=%s", str_names[i], cv); + sprintf(buffer, "%s=%s", name, cv); len += strlen(tterm->Strings[i]) + 1; } else { char *src = _nc_tic_expand(tterm->Strings[i], outform==F_TERMINFO, numbers); - sprintf(buffer, "%s=", str_names[i]); + sprintf(buffer, "%s=", name); if (pretty && outform==F_TERMINFO) fmt_complex(buffer + strlen(buffer), src, 1); else @@ -746,7 +751,7 @@ int dump_entry(TERMTYPE *tterm, bool limited, bool numbers, int (*pred)(int type infodump = TRUE; } - if (((len = fmt_entry(tterm, pred, FALSE, infodump, numbers)) > critlen) && limited) + if (((len = fmt_entry(tterm, pred, outform == F_TERMCAP ? TRUE : FALSE, infodump, numbers)) > critlen) && limited) { (void) printf("# (untranslatable capabilities removed to fit entry within %d bytes)\n", critlen); @@ -800,54 +805,49 @@ int dump_uses(const char *name, bool infodump) return out_used; } -void compare_entry(void (*hook)(int t, int i, const char *name)) +void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GCC_UNUSED) /* compare two entries */ { int i, j; + char * name; (void) fputs(" comparing booleans.\n", stdout); - for (j=0; j < BOOLCOUNT; j++) + for_each_boolean(j,tp) { - if (sortmode == S_NOSORT) - i = j; - else - i = bool_indirect[j]; + i = BoolIndirect(j); + name = ExtBoolname(tp,i,bool_names); if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE) - && (OBSOLETE(bool_names[i]) && outform != F_LITERAL)) + && (OBSOLETE(name) && outform != F_LITERAL)) continue; - (*hook)(BOOLEAN, i, bool_names[i]); + (*hook)(BOOLEAN, i, name); } (void) fputs(" comparing numbers.\n", stdout); - for (j=0; j < NUMCOUNT; j++) + for_each_number(j,tp) { - if (sortmode == S_NOSORT) - i = j; - else - i = num_indirect[j]; + i = NumIndirect(j); + name = ExtNumname(tp,i,num_names); if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE) - && (OBSOLETE(num_names[i]) && outform != F_LITERAL)) + && (OBSOLETE(name) && outform != F_LITERAL)) continue; - (*hook)(NUMBER, i, num_names[i]); + (*hook)(NUMBER, i, name); } (void) fputs(" comparing strings.\n", stdout); - for (j=0; j < STRCOUNT; j++) + for_each_string(j,tp) { - if (sortmode == S_NOSORT) - i = j; - else - i = str_indirect[j]; + i = StrIndirect(j); + name = ExtStrname(tp,i,str_names); if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE) - && (OBSOLETE(str_names[i]) && outform != F_LITERAL)) + && (OBSOLETE(name) && outform != F_LITERAL)) continue; - (*hook)(STRING, i, str_names[i]); + (*hook)(STRING, i, name); } } diff --git a/usr.bin/tic/dump_entry.h b/usr.bin/tic/dump_entry.h index 5a15274a1a7..dffea03745e 100644 --- a/usr.bin/tic/dump_entry.h +++ b/usr.bin/tic/dump_entry.h @@ -1,7 +1,7 @@ -/* $OpenBSD: dump_entry.h,v 1.2 1998/11/03 21:59:53 millert Exp $ */ +/* $OpenBSD: dump_entry.h,v 1.3 1999/03/02 06:23:55 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 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 * @@ -57,6 +57,6 @@ extern void dump_init(const char *, int, int, int, int, bool); extern int fmt_entry(TERMTYPE *, int (*)(int, int), bool, bool, bool); extern int dump_entry(TERMTYPE *, bool, bool, int (*)(int, int)); extern int dump_uses(const char *, bool); -extern void compare_entry(void (*)(int, int, const char *)); +extern void compare_entry(void (*)(int, int, const char *), TERMTYPE *); #define FAIL -1 diff --git a/usr.bin/tic/progs.priv.h b/usr.bin/tic/progs.priv.h index b2b059d0f7c..2094fa4074b 100644 --- a/usr.bin/tic/progs.priv.h +++ b/usr.bin/tic/progs.priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: progs.priv.h,v 1.2 1998/11/03 21:59:53 millert Exp $ */ +/* $OpenBSD: progs.priv.h,v 1.3 1999/03/02 06:23:55 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998 Free Software Foundation, Inc. * @@ -32,7 +32,7 @@ * Author: Thomas E. Dickey <dickey@clark.net> 1997,1998 * ****************************************************************************/ /* - * $From: progs.priv.h,v 1.18 1998/07/25 17:38:51 tom Exp $ + * $From: progs.priv.h,v 1.19 1999/02/23 11:10:32 tom Exp $ * * progs.priv.h * @@ -104,7 +104,7 @@ extern int optind; #endif /* HAVE_GETOPT_H */ #include <curses.h> -#include <term.h> +#include <term_entry.h> #include <tic.h> #include <nc_alloc.h> diff --git a/usr.bin/tic/tic.1 b/usr.bin/tic/tic.1 index 6bda1732bec..f471ac819af 100644 --- a/usr.bin/tic/tic.1 +++ b/usr.bin/tic/tic.1 @@ -1,7 +1,7 @@ -.\" $OpenBSD: tic.1,v 1.3 1999/01/18 18:57:52 millert Exp $ +.\" $OpenBSD: tic.1,v 1.4 1999/03/02 06:23:55 millert Exp $ .\" .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,1999 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 * @@ -28,7 +28,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $From: tic.1m,v 1.23 1998/12/26 01:47:41 tom Exp $ +.\" $From: tic.1m,v 1.24 1999/02/23 02:18:15 tom Exp $ .TH tic 1 "" .ds n 5 .ds d /usr/share/terminfo @@ -47,6 +47,7 @@ c\ f\ r\ s\ +x\ \fR] [\fB-e\fR \fInames\fR] [\fB-o\fR \fIdir\fR] @@ -166,6 +167,9 @@ rather than their decimal equivalents. Summarize the compile by showing the directory into which entries are written, and the number of entries which are compiled. .TP +\fB-x\fR +Treat unknown capabilities as user-defined. +.TP \fIfile\fR contains one or more \fBterminfo\fR terminal descriptions in source format [see \fBterminfo\fR(\*n)]. Each description in the file @@ -254,8 +258,9 @@ The \fB-f\fR, \fB-g\fR, \fB-T\fR, -\fB-r\fR and -\fB-s\fR +\fB-r\fR, +\fB-s\fR and +\fB-x\fR options are not supported under SVr4. The SVr4 -c mode does not report bad use links. @@ -267,7 +272,7 @@ System V does not compile entries to or read entries from your \fB\*d/?/*\fR Compiled terminal description database. .SH SEE ALSO -\fBcaptoinfo\fR(1), \fBcurses\fR(3), \fBterminfo\fR(\*n). +\fBinfocmp\fR(1), \fBcaptoinfo\fR(1), \fBcurses\fR(3), \fBterminfo\fR(\*n). .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c index 8b992710d62..5ae08f3d565 100644 --- a/usr.bin/tic/tic.c +++ b/usr.bin/tic/tic.c @@ -1,7 +1,7 @@ -/* $OpenBSD: tic.c,v 1.6 1999/02/24 06:38:23 millert Exp $ */ +/* $OpenBSD: tic.c,v 1.7 1999/03/02 06:23:55 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,1999 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 * @@ -44,7 +44,7 @@ #include <dump_entry.h> #include <term_entry.h> -MODULE_ID("$From: tic.c,v 1.45 1999/02/19 10:40:00 tom Exp $") +MODULE_ID("$From: tic.c,v 1.48 1999/03/01 00:26:51 tom Exp $") const char *_nc_progname = "tic"; @@ -56,7 +56,7 @@ static const char *to_remove; static void (*save_check_termtype)(TERMTYPE *); static void check_termtype(TERMTYPE *tt); -static const char usage_string[] = "[-h] [-v[n]] [-e names] [-CILNRTcfrsw1] source-file\n"; +static const char usage_string[] = "[-h] [-v[n]] [-e names] [-CILNRTcfrswx1] source-file\n"; static void cleanup(void) { @@ -93,6 +93,9 @@ static void usage(void) " -s print summary statistics", " -v[n] set verbosity level", " -w[n] set format width for translation output", +#if NCURSES_XNAMES + " -x treat unknown capabilities as user-defined", +#endif "", "Parameters:", " <file> file to translate or compile" @@ -204,9 +207,8 @@ static bool immedhook(ENTRY *ep GCC_UNUSED) free(ep->tterm.str_table); return(TRUE); } - else #endif /* HAVE_BIG_CORE */ - return(FALSE); + return(FALSE); } static void put_translate(int c) @@ -404,13 +406,16 @@ bool check_only = FALSE; infodump = (strcmp(_nc_progname, "captoinfo") == 0); capdump = (strcmp(_nc_progname, "infotocap") == 0); +#if NCURSES_XNAMES + use_extended_names(FALSE); +#endif /* * Processing arguments is a little complicated, since someone made a * design decision to allow the numeric values for -w, -v options to * be optional. */ - while ((this_opt = getopt(argc, argv, "0123456789CILNR:TVce:fgo:rsvw")) != EOF) { + while ((this_opt = getopt(argc, argv, "0123456789CILNR:TVce:fgo:rsvwx")) != EOF) { if (isdigit(this_opt)) { switch (last_opt) { case 'v': @@ -482,6 +487,11 @@ bool check_only = FALSE; case 'w': width = 0; break; +#if NCURSES_XNAMES + case 'x': + use_extended_names(TRUE); + break; +#endif default: usage(); } |