1 /****************************************************************************
2 * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
31 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
32 * and: Thomas E. Dickey 1996 on *
33 ****************************************************************************/
36 * tic.c --- Main program for terminfo compiler
41 #include <progs.priv.h>
44 #include <dump_entry.h>
45 #include <term_entry.h>
46 #include <transform.h>
48 MODULE_ID("$Id: tic.c,v 1.109 2003/12/06 17:36:57 tom Exp $")
50 const char *_nc_progname = "tic";
54 static bool showsummary = FALSE;
55 static const char *to_remove;
56 static int tparm_errs;
58 static void (*save_check_termtype) (TERMTYPE *);
59 static void check_termtype(TERMTYPE * tt);
61 static const char usage_string[] = "[-V] [-v[n]] [-e names] [-o dir] [-R name] [-CILNTcfrswx1] source-file\n";
78 failed(const char *msg)
82 ExitProgram(EXIT_FAILURE);
88 static const char *const tbl[] =
91 " -1 format translation output one capability per line",
93 " -a retain commented-out capabilities (sets -x also)",
95 " -C translate entries to termcap source form",
96 " -c check only, validate input without compiling or translating",
97 " -e<names> translate/compile only entries named by comma-separated list",
98 " -f format complex strings for readability",
99 " -G format %{number} to %'char'",
100 " -g format %'char' to %{number}",
101 " -I translate entries to terminfo source form",
102 " -L translate entries to full terminfo source form",
103 " -N disable smart defaults for source translation",
104 " -o<dir> set output directory for compiled entry writes",
105 " -R<name> restrict translation to given terminfo/termcap version",
106 " -r force resolution of all use entries in source translation",
107 " -s print summary statistics",
108 " -T remove size-restrictions on compiled description",
110 " -t suppress commented-out capabilities",
113 " -v[n] set verbosity level",
114 " -w[n] set format width for translation output",
116 " -x treat unknown capabilities as user-defined",
120 " <file> file to translate or compile"
124 fprintf(stderr, "Usage: %s %s\n", _nc_progname, usage_string);
125 for (j = 0; j < SIZEOF(tbl); j++) {
126 fputs(tbl[j], stderr);
129 ExitProgram(EXIT_FAILURE);
134 #define S_QUOTE '\'';
142 char result[MAX_ENTRY_SIZE];
145 * Look for strings that contain %{number}, convert them to %'char',
146 * which is shorter and runs a little faster.
148 for (n = 0; n < STRCOUNT; n++) {
149 s = ep->tterm.Strings[n];
151 && strchr(s, L_BRACE) != 0) {
154 while ((ch = *t++) != 0) {
158 } else if ((ch == '%')
159 && (*t == L_BRACE)) {
161 long value = strtol(t + 1, &v, 0);
165 && value != '\\' /* FIXME */
167 && isprint((int) value)) {
176 if (strlen(result) < strlen(s))
181 _nc_set_type(_nc_first_name(ep->tterm.term_names));
182 _nc_curr_line = ep->startline;
183 _nc_write_entry(&ep->tterm);
187 immedhook(ENTRY * ep GCC_UNUSED)
188 /* write out entries with no use capabilities immediately to save storage */
192 * This is strictly a core-economy kluge. The really clean way to handle
193 * compilation is to slurp the whole file into core and then do all the
194 * name-collision checks and entry writes in one swell foop. But the
195 * terminfo master file is large enough that some core-poor systems swap
196 * like crazy when you compile it this way...there have been reports of
197 * this process taking *three hours*, rather than the twenty seconds or
198 * less typical on my development box.
200 * So. This hook *immediately* writes out the referenced entry if it
201 * has no use capabilities. The compiler main loop refrains from
202 * adding the entry to the in-core list when this hook fires. If some
203 * other entry later needs to reference an entry that got written
204 * immediately, that's OK; the resolution code will fetch it off disk
205 * when it can't find it in core.
207 * Name collisions will still be detected, just not as cleanly. The
208 * write_entry() code complains before overwriting an entry that
209 * postdates the time of tic's first call to write_entry(). Thus
210 * it will complain about overwriting entries newly made during the
211 * tic run, but not about overwriting ones that predate it.
213 * The reason this is a hook, and not in line with the rest of the
214 * compiler code, is that the support for termcap fallback cannot assume
215 * it has anywhere to spool out these entries!
217 * The _nc_set_type() call here requires a compensating one in
220 * If you define HAVE_BIG_CORE, you'll disable this kluge. This will
221 * make tic a bit faster (because the resolution code won't have to do
222 * disk I/O nearly as often).
224 if (ep->nuses == 0) {
225 int oldline = _nc_curr_line;
228 _nc_curr_line = oldline;
229 free(ep->tterm.str_table);
232 #endif /* HAVE_BIG_CORE */
238 /* emit a comment char, translating terminfo names to termcap names */
240 static bool in_name = FALSE;
241 static size_t have, used;
242 static char *namebuf, *suffix;
245 if (used + 1 >= have) {
247 namebuf = typeRealloc(char, have, namebuf);
248 suffix = typeRealloc(char, have, suffix);
250 if (c == '\n' || c == '@') {
251 namebuf[used++] = '\0';
253 (void) fputs(namebuf, stdout);
256 } else if (c != '>') {
258 } else { /* ah! candidate name! */
260 NCURSES_CONST char *tp;
262 namebuf[used++] = '\0';
266 if ((up = strchr(namebuf, '#')) != 0
267 || (up = strchr(namebuf, '=')) != 0
268 || ((up = strchr(namebuf, '@')) != 0 && up[1] == '>')) {
269 (void) strcpy(suffix, up);
273 if ((tp = nametrans(namebuf)) != 0) {
275 (void) fputs(tp, stdout);
276 (void) fputs(suffix, stdout);
279 /* couldn't find a translation, just dump the name */
281 (void) fputs(namebuf, stdout);
282 (void) fputs(suffix, stdout);
296 /* Returns a string, stripped of leading/trailing whitespace */
300 while (isspace(UChar(*src)))
303 char *dst = strcpy((char *) malloc(strlen(src) + 1), src);
304 size_t len = strlen(dst);
305 while (--len != 0 && isspace(UChar(dst[len])))
313 open_input(const char *filename)
315 FILE *fp = fopen(filename, "r");
319 fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename);
320 ExitProgram(EXIT_FAILURE);
322 if (fstat(fileno(fp), &sb) < 0
323 || (sb.st_mode & S_IFMT) != S_IFREG) {
324 fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename);
325 ExitProgram(EXIT_FAILURE);
330 /* Parse the "-e" option-value into a list of names */
332 make_namelist(char *src)
334 const char **dst = 0;
337 unsigned pass, n, nn;
342 } else if (strchr(src, '/') != 0) { /* a filename */
343 FILE *fp = open_input(src);
345 for (pass = 1; pass <= 2; pass++) {
347 while (fgets(buffer, sizeof(buffer), fp) != 0) {
348 if ((s = stripped(buffer)) != 0) {
355 dst = typeCalloc(const char *, nn + 1);
360 } else { /* literal list of names */
361 for (pass = 1; pass <= 2; pass++) {
362 for (n = nn = 0, base = src;; n++) {
364 if (mark == ',' || mark == '\0') {
369 if ((s = stripped(base)) != 0)
378 dst = typeCalloc(const char *, nn + 1);
382 fprintf(log_fp, "Entries that will be compiled:\n");
383 for (n = 0; dst[n] != 0; n++)
384 fprintf(log_fp, "%d:%s\n", n + 1, dst[n]);
390 matches(const char **needle, const char *haystack)
391 /* does entry in needle list match |-separated field in haystack? */
397 for (n = 0; needle[n] != 0; n++) {
398 if (_nc_name_match(haystack, needle[n], "|")) {
409 open_tempfile(char *name)
413 int fd = mkstemp(name);
415 result = fdopen(fd, "w");
417 if (tmpnam(name) != 0)
418 result = fopen(name, "w");
424 main(int argc, char *argv[])
426 char my_tmpname[PATH_MAX];
427 int v_opt = -1, debug_level;
428 int smart_defaults = TRUE;
432 int this_opt, last_opt = '?';
434 int outform = F_TERMINFO; /* output format */
435 int sortmode = S_TERMINFO; /* sort_mode */
438 bool formatted = FALSE; /* reformat complex strings? */
439 int numbers = 0; /* format "%'char'" to/from "%{number}" */
440 bool infodump = FALSE; /* running as captoinfo? */
441 bool capdump = FALSE; /* running as infotocap? */
442 bool forceresolve = FALSE; /* force resolution */
444 char *tversion = (char *) NULL;
445 const char *source_file = "terminfo";
446 const char **namelst = 0;
447 char *outdir = (char *) NULL;
448 bool check_only = FALSE;
449 bool suppress_untranslatable = FALSE;
453 _nc_progname = _nc_rootname(argv[0]);
455 if ((infodump = (strcmp(_nc_progname, PROG_CAPTOINFO) == 0)) != FALSE) {
456 outform = F_TERMINFO;
457 sortmode = S_TERMINFO;
459 if ((capdump = (strcmp(_nc_progname, PROG_INFOTOCAP) == 0)) != FALSE) {
461 sortmode = S_TERMCAP;
464 use_extended_names(FALSE);
468 * Processing arguments is a little complicated, since someone made a
469 * design decision to allow the numeric values for -w, -v options to
472 while ((this_opt = getopt(argc, argv,
473 "0123456789CILNR:TVace:fGgo:rstvwx")) != EOF) {
474 if (isdigit(this_opt)) {
477 v_opt = (v_opt * 10) + (this_opt - '0');
480 width = (width * 10) + (this_opt - '0');
494 sortmode = S_TERMCAP;
498 outform = F_TERMINFO;
499 sortmode = S_TERMINFO;
503 outform = F_VARIABLE;
504 sortmode = S_VARIABLE;
507 smart_defaults = FALSE;
516 puts(curses_version());
522 namelst = make_namelist(optarg);
550 _nc_disable_period = FALSE;
551 suppress_untranslatable = TRUE;
554 _nc_disable_period = TRUE;
557 use_extended_names(TRUE);
566 debug_level = (v_opt > 0) ? v_opt : (v_opt == 0);
567 set_trace_level(debug_level);
570 save_check_termtype = _nc_check_termtype;
571 _nc_check_termtype = check_termtype;
575 * Aaargh! immedhook seriously hoses us!
577 * One problem with immedhook is it means we can't do -e. Problem
578 * is that we can't guarantee that for each terminal listed, all the
579 * terminals it depends on will have been kept in core for reference
580 * resolution -- in fact it's certain the primitive types at the end
581 * of reference chains *won't* be in core unless they were explicitly
582 * in the select list themselves.
584 if (namelst && (!infodump && !capdump)) {
585 (void) fprintf(stderr,
586 "Sorry, -e can't be used without -I or -C\n");
590 #endif /* HAVE_BIG_CORE */
593 source_file = argv[optind++];
596 "%s: Too many file names. Usage:\n\t%s %s",
603 if (infodump == TRUE) {
604 /* captoinfo's no-argument case */
605 source_file = "/etc/termcap";
606 if ((termcap = getenv("TERMCAP")) != 0
607 && (namelst = make_namelist(getenv("TERM"))) != 0) {
608 if (access(termcap, F_OK) == 0) {
610 source_file = termcap;
611 } else if ((tmp_fp = open_tempfile(strcpy(my_tmpname,
614 source_file = my_tmpname;
615 fprintf(tmp_fp, "%s\n", termcap);
617 tmp_fp = open_input(source_file);
618 to_remove = source_file;
626 "%s: File name needed. Usage:\n\t%s %s",
636 tmp_fp = open_input(source_file);
643 sortmode, width, debug_level, formatted);
647 sortmode, width, debug_level, FALSE);
649 /* parse entries out of the source file */
650 _nc_set_source(source_file);
652 if (!(check_only || infodump || capdump))
653 _nc_set_writedir(outdir);
654 #endif /* HAVE_BIG_CORE */
655 _nc_read_entry_source(tmp_fp, (char *) NULL,
656 !smart_defaults, FALSE,
657 (check_only || infodump || capdump) ? NULLHOOK : immedhook);
659 /* do use resolution */
660 if (check_only || (!infodump && !capdump) || forceresolve) {
661 if (!_nc_resolve_uses(TRUE) && !check_only) {
668 if (check_only && (capdump || infodump)) {
670 if (matches(namelst, qp->tterm.term_names)) {
671 int len = fmt_entry(&qp->tterm, NULL, FALSE, TRUE, infodump, numbers);
673 if (len > (infodump ? MAX_TERMINFO_LENGTH : MAX_TERMCAP_LENGTH))
674 (void) fprintf(stderr,
675 "warning: resolved %s entry is %d bytes long\n",
676 _nc_first_name(qp->tterm.term_names),
682 /* write or dump all entries */
684 if (!infodump && !capdump) {
685 _nc_set_writedir(outdir);
687 if (matches(namelst, qp->tterm.term_names))
691 /* this is in case infotocap() generates warnings */
692 _nc_curr_col = _nc_curr_line = -1;
695 if (matches(namelst, qp->tterm.term_names)) {
696 int j = qp->cend - qp->cstart;
699 /* this is in case infotocap() generates warnings */
700 _nc_set_type(_nc_first_name(qp->tterm.term_names));
702 (void) fseek(tmp_fp, qp->cstart, SEEK_SET);
705 (void) putchar(fgetc(tmp_fp));
707 put_translate(fgetc(tmp_fp));
710 len = dump_entry(&qp->tterm, suppress_untranslatable,
711 limited, 0, numbers, NULL);
712 for (j = 0; j < qp->nuses; j++)
713 len += dump_uses(qp->uses[j].name, !capdump);
714 (void) putchar('\n');
715 if (debug_level != 0 && !limited)
716 printf("# length=%d\n", len);
719 if (!namelst && _nc_tail) {
721 bool in_comment = FALSE;
722 bool trailing_comment = FALSE;
724 (void) fseek(tmp_fp, _nc_tail->cend, SEEK_SET);
725 while ((c = fgetc(tmp_fp)) != EOF) {
728 trailing_comment = TRUE;
735 && (in_comment || (oldc == '\n' && c == '\n')))
743 /* Show the directory into which entries were written, and the total
747 && (!(check_only || infodump || capdump))) {
748 int total = _nc_tic_written();
750 fprintf(log_fp, "%d entries written to %s\n",
752 _nc_tic_dir((char *) 0));
754 fprintf(log_fp, "No entries written\n");
757 return (EXIT_SUCCESS);
761 * This bit of legerdemain turns all the terminfo variable names into
762 * references to locations in the arrays Booleans, Numbers, and Strings ---
763 * precisely what's needed (see comp_parse.c).
766 TERMINAL *cur_term; /* tweak to avoid linking lib_cur_term.c */
772 * Check if the alternate character-set capabilities are consistent.
775 check_acs(TERMTYPE * tp)
777 if (VALID_STRING(acs_chars)) {
778 const char *boxes = "lmkjtuvwqxn";
784 memset(mapped, 0, sizeof(mapped));
785 for (p = acs_chars; *p != '\0'; p += 2) {
787 _nc_warning("acsc has odd number of characters");
790 mapped[UChar(p[0])] = p[1];
792 if (mapped[UChar('I')] && !mapped[UChar('i')]) {
793 _nc_warning("acsc refers to 'I', which is probably an error");
795 for (p = boxes, q = missing; *p != '\0'; ++p) {
796 if (!mapped[UChar(p[0])]) {
801 if (*missing != '\0' && strcmp(missing, boxes)) {
802 _nc_warning("acsc is missing some line-drawing mapping: %s", missing);
808 * Check if the color capabilities are consistent
811 check_colors(TERMTYPE * tp)
813 if ((max_colors > 0) != (max_pairs > 0)
814 || ((max_colors > max_pairs) && (initialize_pair == 0)))
815 _nc_warning("inconsistent values for max_colors (%d) and max_pairs (%d)",
816 max_colors, max_pairs);
818 PAIRED(set_foreground, set_background);
819 PAIRED(set_a_foreground, set_a_background);
820 PAIRED(set_color_pair, initialize_pair);
822 if (VALID_STRING(set_foreground)
823 && VALID_STRING(set_a_foreground)
824 && !strcmp(set_foreground, set_a_foreground))
825 _nc_warning("expected setf/setaf to be different");
827 if (VALID_STRING(set_background)
828 && VALID_STRING(set_a_background)
829 && !strcmp(set_background, set_a_background))
830 _nc_warning("expected setb/setab to be different");
832 /* see: has_colors() */
833 if (VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
834 && (((set_foreground != NULL)
835 && (set_background != NULL))
836 || ((set_a_foreground != NULL)
837 && (set_a_background != NULL))
838 || set_color_pair)) {
839 if (!VALID_STRING(orig_pair) && !VALID_STRING(orig_colors))
840 _nc_warning("expected either op/oc string for resetting colors");
845 keypad_final(const char *string)
849 if (VALID_STRING(string)
850 && *string++ == '\033'
852 && strlen(string) == 1) {
860 keypad_index(const char *string)
863 const char *list = "PQRSwxymtuvlqrsPpn"; /* app-keypad except "Enter" */
867 if ((ch = keypad_final(string)) != '\0') {
868 test = strchr(list, ch);
870 result = (test - list);
876 * Do a quick sanity-check for vt100-style keypads to see if the 5-key keypad
877 * is mapped inconsistently.
880 check_keypad(TERMTYPE * tp)
884 if (VALID_STRING(key_a1) &&
885 VALID_STRING(key_a3) &&
886 VALID_STRING(key_b2) &&
887 VALID_STRING(key_c1) &&
888 VALID_STRING(key_c3)) {
896 final[0] = keypad_final(key_a1);
897 final[1] = keypad_final(key_a3);
898 final[2] = keypad_final(key_b2);
899 final[3] = keypad_final(key_c1);
900 final[4] = keypad_final(key_c3);
903 /* special case: legacy coding using 1,2,3,0,. on the bottom */
904 if (!strcmp(final, "qsrpn"))
907 list[0] = keypad_index(key_a1);
908 list[1] = keypad_index(key_a3);
909 list[2] = keypad_index(key_b2);
910 list[3] = keypad_index(key_c1);
911 list[4] = keypad_index(key_c3);
913 /* check that they're all vt100 keys */
914 for (j = 0; j < 5; ++j) {
920 /* check if they're all in increasing order */
921 for (j = 1; j < 5; ++j) {
922 if (list[j] > list[j - 1]) {
929 for (j = 0, last = -1; j < 5; ++j) {
930 for (k = 0, kk = -1, test = 100; k < 5; ++k) {
931 if (list[k] > last &&
940 strcat(show, " ka1");
943 strcat(show, " ka3");
946 strcat(show, " kb2");
949 strcat(show, " kc1");
952 strcat(show, " kc3");
957 _nc_warning("vt100 keypad order inconsistent: %s", show);
960 } else if (VALID_STRING(key_a1) ||
961 VALID_STRING(key_a3) ||
962 VALID_STRING(key_b2) ||
963 VALID_STRING(key_c1) ||
964 VALID_STRING(key_c3)) {
966 if (keypad_index(key_a1) >= 0)
967 strcat(show, " ka1");
968 if (keypad_index(key_a3) >= 0)
969 strcat(show, " ka3");
970 if (keypad_index(key_b2) >= 0)
971 strcat(show, " kb2");
972 if (keypad_index(key_c1) >= 0)
973 strcat(show, " kc1");
974 if (keypad_index(key_c3) >= 0)
975 strcat(show, " kc3");
977 _nc_warning("vt100 keypad map incomplete:%s", show);
982 * Returns the expected number of parameters for the given capability.
985 expected_params(const char *name)
988 static const struct {
992 { "S0", 1 }, /* 'screen' extension */
1045 { "smgbp", 1 }, /* 2 if smgtp is not given */
1060 int result = 0; /* function-keys, etc., use none */
1062 for (n = 0; n < SIZEOF(table); n++) {
1063 if (!strcmp(name, table[n].name)) {
1064 result = table[n].count;
1073 * Make a quick sanity check for the parameters which are used in the given
1074 * strings. If there are no "%p" tokens, then there should be no other "%"
1078 check_params(TERMTYPE * tp, const char *name, char *value)
1080 int expected = expected_params(name);
1086 #ifdef set_top_margin_parm
1087 if (!strcmp(name, "smgbp")
1088 && set_top_margin_parm == 0)
1092 for (n = 0; n < 10; n++)
1098 _nc_warning("expected character after %% in %s", name);
1100 } else if (*s == 'p') {
1101 if (*++s == '\0' || !isdigit((int) *s)) {
1102 _nc_warning("expected digit after %%p in %s", name);
1116 _nc_warning("%s refers to parameter 0 (%%p0), which is not allowed", name);
1118 if (value == set_attributes || expected < 0) {
1120 } else if (expected != actual) {
1121 _nc_warning("%s uses %d parameters, expected %d", name,
1123 for (n = 1; n < actual; n++) {
1125 _nc_warning("%s omits parameter %d", name, n);
1133 while (*s == '/' || isdigit(UChar(*s)))
1139 * An sgr string may contain several settings other than the one we're
1140 * interested in, essentially sgr0 + rmacs + whatever. As long as the
1141 * "whatever" is contained in the sgr string, that is close enough for our
1145 similar_sgr(int num, char *a, char *b)
1147 static const char *names[] =
1169 _nc_warning("Did not find delay %s", _nc_visbuf(b));
1171 _nc_warning("checking sgr(%s) %s\n\tcompare to %s\n\tunmatched %s",
1172 names[num], _nc_visbuf2(1, base_a),
1173 _nc_visbuf2(2, base_b),
1177 } else if (delaying) {
1204 check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, const char *name)
1206 char *test = tparm(set_attributes,
1216 tparm_errs += _nc_tparm_err;
1219 if (!similar_sgr(num, test, cap)) {
1220 _nc_warning("%s differs from sgr(%d)\n\t%s=%s\n\tsgr(%d)=%s",
1222 name, _nc_visbuf2(1, cap),
1223 num, _nc_visbuf2(2, test));
1225 } else if (strcmp(test, zero)) {
1226 _nc_warning("sgr(%d) present, but not %s", num, name);
1228 } else if (PRESENT(cap)) {
1229 _nc_warning("sgr(%d) missing, but %s present", num, name);
1233 #define CHECK_SGR(num,name) check_sgr(tp, zero, num, name, #name)
1235 /* other sanity-checks (things that we don't want in the normal
1236 * logic that reads a terminfo entry)
1239 check_termtype(TERMTYPE * tp)
1241 bool conflict = FALSE;
1243 char fkeys[STRCOUNT];
1246 * A terminal entry may contain more than one keycode assigned to
1247 * a given string (e.g., KEY_END and KEY_LL). But curses will only
1248 * return one (the last one assigned).
1250 memset(fkeys, 0, sizeof(fkeys));
1251 for (j = 0; _nc_tinfo_fkeys[j].code; j++) {
1252 char *a = tp->Strings[_nc_tinfo_fkeys[j].offset];
1254 if (!VALID_STRING(a))
1256 for (k = j + 1; _nc_tinfo_fkeys[k].code; k++) {
1257 char *b = tp->Strings[_nc_tinfo_fkeys[k].offset];
1258 if (!VALID_STRING(b)
1261 if (!strcmp(a, b)) {
1266 _nc_warning("Conflicting key definitions (using the last)");
1269 fprintf(stderr, "... %s is the same as %s",
1270 keyname(_nc_tinfo_fkeys[j].code),
1271 keyname(_nc_tinfo_fkeys[k].code));
1274 fprintf(stderr, ", %s",
1275 keyname(_nc_tinfo_fkeys[k].code));
1280 fprintf(stderr, "\n");
1283 for (j = 0; j < NUM_STRINGS(tp); j++) {
1284 char *a = tp->Strings[j];
1285 if (VALID_STRING(a))
1286 check_params(tp, ExtStrname(tp, j, strnames), a);
1294 * These may be mismatched because the terminal description relies on
1295 * restoring the cursor visibility by resetting it.
1297 ANDMISSING(cursor_invisible, cursor_normal);
1298 ANDMISSING(cursor_visible, cursor_normal);
1300 if (PRESENT(cursor_visible) && PRESENT(cursor_normal)
1301 && !strcmp(cursor_visible, cursor_normal))
1302 _nc_warning("cursor_visible is same as cursor_normal");
1305 * From XSI & O'Reilly, we gather that sc/rc are required if csr is
1306 * given, because the cursor position after the scrolling operation is
1307 * performed is undefined.
1309 ANDMISSING(change_scroll_region, save_cursor);
1310 ANDMISSING(change_scroll_region, restore_cursor);
1313 if (PRESENT(set_attributes)) {
1314 char *zero = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1316 zero = strdup(zero);
1317 CHECK_SGR(1, enter_standout_mode);
1318 CHECK_SGR(2, enter_underline_mode);
1319 CHECK_SGR(3, enter_reverse_mode);
1320 CHECK_SGR(4, enter_blink_mode);
1321 CHECK_SGR(5, enter_dim_mode);
1322 CHECK_SGR(6, enter_bold_mode);
1323 CHECK_SGR(7, enter_secure_mode);
1324 CHECK_SGR(8, enter_protected_mode);
1325 CHECK_SGR(9, enter_alt_charset_mode);
1328 _nc_warning("stack error in sgr string");
1332 * Some standard applications (e.g., vi) and some non-curses
1333 * applications (e.g., jove) get confused if we have both ich1 and
1334 * smir/rmir. Let's be nice and warn about that, too, even though
1335 * ncurses handles it.
1337 if ((PRESENT(enter_insert_mode) || PRESENT(exit_insert_mode))
1338 && PRESENT(parm_ich)) {
1339 _nc_warning("non-curses applications may be confused by ich1 with smir/rmir");
1343 * Finally, do the non-verbose checks
1345 if (save_check_termtype != 0)
1346 save_check_termtype(tp);