1 /****************************************************************************
2 * Copyright (c) 1998,1999,2000 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 ****************************************************************************/
35 * parse_entry.c -- compile one terminfo or termcap entry
37 * Get an exact in-core representation of an entry. Don't
38 * try to resolve use or tc capabilities, that is someone
39 * else's job. Depends on the lexical analyzer to get tokens
40 * from the input stream.
43 #include <curses.priv.h>
47 #define __INTERNAL_CAPS_VISIBLE
48 #include <term_entry.h>
50 MODULE_ID("$Id: parse_entry.c,v 1.44 2000/04/30 00:17:42 tom Exp $")
53 static short const parametrized[] =
56 #include <parametrized.h>
59 static void postprocess_termcap(TERMTYPE *, bool);
60 static void postprocess_terminfo(TERMTYPE *);
61 static struct name_table_entry const *lookup_fullname(const char *name);
65 static struct name_table_entry const *
66 _nc_extend_names(ENTRY * entryp, char *name, int token_type)
68 static struct name_table_entry temp;
69 TERMTYPE *tp = &(entryp->tterm);
73 unsigned first, last, n;
79 last = tp->ext_Booleans;
80 offset = tp->ext_Booleans;
81 tindex = tp->num_Booleans;
84 first = tp->ext_Booleans;
85 last = tp->ext_Numbers + first;
86 offset = tp->ext_Booleans + tp->ext_Numbers;
87 tindex = tp->num_Numbers;
90 first = tp->ext_Booleans + tp->ext_Numbers;
91 last = tp->ext_Strings + first;
92 offset = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings;
93 tindex = tp->num_Strings;
96 actual = NUM_EXT_NAMES(tp);
97 for (n = 0; n < actual; n++) {
98 if (!strcmp(name, tp->ext_Names[n])) {
99 if (n > (unsigned) (tp->ext_Booleans + tp->ext_Numbers)) {
101 } else if (n > tp->ext_Booleans) {
104 token_type = BOOLEAN;
106 return _nc_extend_names(entryp, name, token_type);
109 /* Well, we are given a cancel for a name that we don't recognize */
110 return _nc_extend_names(entryp, name, STRING);
115 /* Adjust the 'offset' (insertion-point) to keep the lists of extended
118 for (n = first, found = FALSE; n < last; n++) {
119 int cmp = strcmp(tp->ext_Names[n], name);
125 switch (token_type) {
140 switch (token_type) {
142 tp->ext_Booleans += 1;
143 tp->num_Booleans += 1;
144 tp->Booleans = typeRealloc(char, tp->num_Booleans, tp->Booleans);
145 for (last = tp->num_Booleans - 1; last > tindex; last--)
146 tp->Booleans[last] = tp->Booleans[last - 1];
149 tp->ext_Numbers += 1;
150 tp->num_Numbers += 1;
151 tp->Numbers = typeRealloc(short, tp->num_Numbers, tp->Numbers);
152 for (last = tp->num_Numbers - 1; last > tindex; last--)
153 tp->Numbers[last] = tp->Numbers[last - 1];
156 tp->ext_Strings += 1;
157 tp->num_Strings += 1;
158 tp->Strings = typeRealloc(char *, tp->num_Strings, tp->Strings);
159 for (last = tp->num_Strings - 1; last > tindex; last--)
160 tp->Strings[last] = tp->Strings[last - 1];
163 actual = NUM_EXT_NAMES(tp);
164 tp->ext_Names = typeRealloc(char *, actual, tp->ext_Names);
165 while (--actual > offset)
166 tp->ext_Names[actual] = tp->ext_Names[actual - 1];
167 tp->ext_Names[offset] = _nc_save_str(name);
170 temp.nte_name = tp->ext_Names[offset];
171 temp.nte_type = token_type;
172 temp.nte_index = tindex;
177 #endif /* NCURSES_XNAMES */
181 * _nc_parse_entry(entry, literal, silent)
183 * Compile one entry. Doesn't try to resolve use or tc capabilities.
185 * found-forward-use = FALSE
186 * re-initialise internal arrays
188 * if the token was not a name in column 1, complain and die
189 * save names in entry's string table
190 * while (get_token() is not EOF and not NAMES)
191 * check for existance and type-correctness
192 * enter cap into structure
194 * save string in entry's string table
199 _nc_parse_entry(struct entry *entryp, int literal, bool silent)
202 struct name_table_entry const *entry_ptr;
203 char *ptr, namecpy[MAX_NAME_SIZE + 1];
205 token_type = _nc_get_token();
207 if (token_type == EOF)
209 if (token_type != NAMES)
210 _nc_err_abort("Entry does not start with terminal names in column one");
212 _nc_init_entry(&entryp->tterm);
214 entryp->cstart = _nc_comment_start;
215 entryp->cend = _nc_comment_end;
216 entryp->startline = _nc_start_line;
217 DEBUG(2, ("Comment range is %ld to %ld", entryp->cstart, entryp->cend));
219 /* junk the 2-character termcap name, if present */
220 ptr = _nc_curr_token.tk_name;
222 ptr = _nc_curr_token.tk_name + 3;
223 _nc_curr_token.tk_name[2] = '\0';
226 entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr);
228 DEBUG(1, ("Starting '%s'", ptr));
231 * We do this because the one-token lookahead in the parse loop
232 * results in the terminal type getting prematurely set to correspond
233 * to that of the next entry.
235 _nc_set_type(_nc_first_name(entryp->tterm.term_names));
237 /* check for overly-long names and aliases */
238 (void) strncpy(namecpy, entryp->tterm.term_names, MAX_NAME_SIZE);
239 namecpy[MAX_NAME_SIZE] = '\0';
240 if ((ptr = strrchr(namecpy, '|')) != (char *) 0)
242 ptr = strtok(namecpy, "|");
243 if (strlen(ptr) > MAX_ALIAS)
244 _nc_warning("primary name may be too long");
245 while ((ptr = strtok((char *) 0, "|")) != (char *) 0)
246 if (strlen(ptr) > MAX_ALIAS)
247 _nc_warning("alias `%s' may be too long", ptr);
251 for (token_type = _nc_get_token();
252 token_type != EOF && token_type != NAMES;
253 token_type = _nc_get_token()) {
254 if (strcmp(_nc_curr_token.tk_name, "use") == 0
255 || strcmp(_nc_curr_token.tk_name, "tc") == 0) {
256 entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring);
257 entryp->uses[entryp->nuses].line = _nc_curr_line;
260 /* normal token lookup */
261 entry_ptr = _nc_find_entry(_nc_curr_token.tk_name,
262 _nc_syntax ? _nc_cap_hash_table : _nc_info_hash_table);
265 * Our kluge to handle aliasing. The reason it's done
266 * this ugly way, with a linear search, is so the hashing
267 * machinery doesn't have to be made really complicated
268 * (also we get better warnings this way). No point in
269 * making this case fast, aliased caps aren't common now
270 * and will get rarer.
272 if (entry_ptr == NOTFOUND) {
273 const struct alias *ap;
275 if (_nc_syntax == SYN_TERMCAP) {
276 for (ap = _nc_capalias_table; ap->from; ap++)
277 if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) {
278 if (ap->to == (char *) 0) {
279 _nc_warning("%s (%s termcap extension) ignored",
280 ap->from, ap->source);
284 entry_ptr = _nc_find_entry(ap->to, _nc_cap_hash_table);
285 if (entry_ptr && !silent)
286 _nc_warning("%s (%s termcap extension) aliased to %s",
287 ap->from, ap->source, ap->to);
290 } else { /* if (_nc_syntax == SYN_TERMINFO) */
291 for (ap = _nc_infoalias_table; ap->from; ap++)
292 if (strcmp(ap->from, _nc_curr_token.tk_name) == 0) {
293 if (ap->to == (char *) 0) {
294 _nc_warning("%s (%s terminfo extension) ignored",
295 ap->from, ap->source);
299 entry_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
300 if (entry_ptr && !silent)
301 _nc_warning("%s (%s terminfo extension) aliased to %s",
302 ap->from, ap->source, ap->to);
306 if (entry_ptr == NOTFOUND) {
307 entry_ptr = lookup_fullname(_nc_curr_token.tk_name);
313 * If we have extended-names active, we will automatically
314 * define a name based on its context.
316 if (entry_ptr == NOTFOUND
317 && _nc_user_definable
318 && (entry_ptr = _nc_extend_names(entryp,
319 _nc_curr_token.tk_name, token_type)) != 0) {
320 if (_nc_tracing >= DEBUG_LEVEL(1))
321 _nc_warning("extended capability '%s'", _nc_curr_token.tk_name);
323 #endif /* NCURSES_XNAMES */
325 /* can't find this cap name, not even as an alias */
326 if (entry_ptr == NOTFOUND) {
328 _nc_warning("unknown capability '%s'",
329 _nc_curr_token.tk_name);
333 /* deal with bad type/value combinations. */
334 if (token_type != CANCEL && entry_ptr->nte_type != token_type) {
336 * Nasty special cases here handle situations in which type
337 * information can resolve name clashes. Normal lookup
338 * finds the last instance in the capability table of a
339 * given name, regardless of type. find_type_entry looks
340 * for a first matching instance with given type. So as
341 * long as all ambiguous names occur in pairs of distinct
342 * type, this will do the job.
345 /* tell max_attributes from arrow_key_map */
346 if (token_type == NUMBER && !strcmp("ma", _nc_curr_token.tk_name))
347 entry_ptr = _nc_find_type_entry("ma", NUMBER,
348 _nc_get_table(_nc_syntax != 0));
350 /* map terminfo's string MT to MT */
351 else if (token_type == STRING && !strcmp("MT", _nc_curr_token.tk_name))
352 entry_ptr = _nc_find_type_entry("MT", STRING,
353 _nc_get_table(_nc_syntax != 0));
355 /* treat strings without following "=" as empty strings */
356 else if (token_type == BOOLEAN && entry_ptr->nte_type == STRING)
358 /* we couldn't recover; skip this token */
361 const char *type_name;
362 switch (entry_ptr->nte_type) {
364 type_name = "boolean";
367 type_name = "string";
370 type_name = "numeric";
373 type_name = "unknown";
376 _nc_warning("wrong type used for %s capability '%s'",
377 type_name, _nc_curr_token.tk_name);
383 /* now we know that the type/value combination is OK */
384 switch (token_type) {
386 switch (entry_ptr->nte_type) {
388 entryp->tterm.Booleans[entry_ptr->nte_index] = CANCELLED_BOOLEAN;
392 entryp->tterm.Numbers[entry_ptr->nte_index] = CANCELLED_NUMERIC;
396 entryp->tterm.Strings[entry_ptr->nte_index] = CANCELLED_STRING;
402 entryp->tterm.Booleans[entry_ptr->nte_index] = TRUE;
406 entryp->tterm.Numbers[entry_ptr->nte_index] =
407 _nc_curr_token.tk_valnumber;
411 ptr = _nc_curr_token.tk_valstring;
412 if (_nc_syntax == SYN_TERMCAP)
413 ptr = _nc_captoinfo(_nc_curr_token.tk_name,
415 parametrized[entry_ptr->nte_index]);
416 entryp->tterm.Strings[entry_ptr->nte_index] = _nc_save_str(ptr);
421 _nc_warning("unknown token type");
422 _nc_panic_mode((_nc_syntax == SYN_TERMCAP) ? ':' : ',');
425 } /* end else cur_token.name != "use" */
427 continue; /* cannot have a label w/o statement */
428 } /* endwhile (not EOF and not NAMES) */
430 _nc_push_token(token_type);
431 _nc_set_type(_nc_first_name(entryp->tterm.term_names));
434 * Try to deduce as much as possible from extension capabilities
435 * (this includes obsolete BSD capabilities). Sigh...it would be more
436 * space-efficient to call this after use resolution, but it has
437 * to be done before entry allocation is wrapped up.
440 if (_nc_syntax == SYN_TERMCAP) {
441 bool has_base_entry = FALSE;
445 * Don't insert defaults if this is a `+' entry meant only
446 * for inclusion in other entries (not sure termcap ever
447 * had these, actually).
449 if (strchr(entryp->tterm.term_names, '+'))
450 has_base_entry = TRUE;
453 * Otherwise, look for a base entry that will already
454 * have picked up defaults via translation.
456 for (i = 0; i < entryp->nuses; i++)
457 if (!strchr((char *) entryp->uses[i].name, '+'))
458 has_base_entry = TRUE;
460 postprocess_termcap(&entryp->tterm, has_base_entry);
462 postprocess_terminfo(&entryp->tterm);
464 _nc_wrap_entry(entryp);
470 _nc_capcmp(const char *s, const char *t)
471 /* compare two string capabilities, stripping out padding */
479 if (s[0] == '$' && s[1] == '<') {
481 if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' ||
486 if (t[0] == '$' && t[1] == '<') {
488 if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' ||
493 /* we've now pushed s and t past any padding they were pointing at */
495 if (*s == '\0' && *t == '\0')
501 /* else *s == *t but one is not NUL, so continue */
507 * The ko capability, if present, consists of a comma-separated capability
508 * list. For each capability, we may assume there is a keycap that sends the
509 * string which is the value of that capability.
515 static assoc const ko_xlate[] =
517 {"al", "kil1"}, /* insert line key -> KEY_IL */
518 {"bt", "kcbt"}, /* back tab -> KEY_BTAB */
519 {"cd", "ked"}, /* clear-to-eos key -> KEY_EOL */
520 {"ce", "kel"}, /* clear-to-eol key -> KEY_EOS */
521 {"cl", "kclr"}, /* clear key -> KEY_CLEAR */
522 {"ct", "tbc"}, /* clear all tabs -> KEY_CATAB */
523 {"dc", "kdch1"}, /* delete char -> KEY_DC */
524 {"dl", "kdl1"}, /* delete line -> KEY_DL */
525 {"do", "kcud1"}, /* down key -> KEY_DOWN */
526 {"ei", "krmir"}, /* exit insert key -> KEY_EIC */
527 {"ho", "khome"}, /* home key -> KEY_HOME */
528 {"ic", "kich1"}, /* insert char key -> KEY_IC */
529 {"im", "kIC"}, /* insert-mode key -> KEY_SIC */
530 {"le", "kcub1"}, /* le key -> KEY_LEFT */
531 {"nd", "kcuf1"}, /* nd key -> KEY_RIGHT */
532 {"nl", "kent"}, /* new line key -> KEY_ENTER */
533 {"st", "khts"}, /* set-tab key -> KEY_STAB */
534 {"ta", CANCELLED_STRING},
535 {"up", "kcuu1"}, /* up-arrow key -> KEY_UP */
536 {(char *) 0, (char *) 0},
540 * This routine fills in string caps that either had defaults under
541 * termcap or can be manufactured from obsolete termcap capabilities.
542 * It was lifted from Ross Ridge's mytinfo package.
545 static const char C_CR[] = "\r";
546 static const char C_LF[] = "\n";
547 static const char C_BS[] = "\b";
548 static const char C_HT[] = "\t";
551 * Note that WANTED and PRESENT are not simple inverses! If a capability
552 * has been explicitly cancelled, it's not considered WANTED.
554 #define WANTED(s) ((s) == ABSENT_STRING)
555 #define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
558 * This bit of legerdemain turns all the terminfo variable names into
559 * references to locations in the arrays Booleans, Numbers, and Strings ---
560 * precisely what's needed.
568 postprocess_termcap(TERMTYPE * tp, bool has_base)
570 char buf[MAX_LINE * 2 + 2];
573 * TERMCAP DEFAULTS AND OBSOLETE-CAPABILITY TRANSLATIONS
575 * This first part of the code is the functional inverse of the
576 * fragment in capdefaults.c.
577 * ----------------------------------------------------------------------
580 /* if there was a tc entry, assume we picked up defaults via that */
582 if (WANTED(init_3string) && termcap_init2)
583 init_3string = _nc_save_str(termcap_init2);
585 if (WANTED(reset_2string) && termcap_reset)
586 reset_2string = _nc_save_str(termcap_reset);
588 if (WANTED(carriage_return)) {
589 if (carriage_return_delay > 0) {
590 sprintf(buf, "%s$<%d>", C_CR, carriage_return_delay);
591 carriage_return = _nc_save_str(buf);
593 carriage_return = _nc_save_str(C_CR);
595 if (WANTED(cursor_left)) {
596 if (backspace_delay > 0) {
597 sprintf(buf, "%s$<%d>", C_BS, backspace_delay);
598 cursor_left = _nc_save_str(buf);
599 } else if (backspaces_with_bs == 1)
600 cursor_left = _nc_save_str(C_BS);
601 else if (PRESENT(backspace_if_not_bs))
602 cursor_left = backspace_if_not_bs;
604 /* vi doesn't use "do", but it does seems to use nl (or '\n') instead */
605 if (WANTED(cursor_down)) {
606 if (PRESENT(linefeed_if_not_lf))
607 cursor_down = linefeed_if_not_lf;
608 else if (linefeed_is_newline != 1) {
609 if (new_line_delay > 0) {
610 sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
611 cursor_down = _nc_save_str(buf);
613 cursor_down = _nc_save_str(C_LF);
616 if (WANTED(scroll_forward) && crt_no_scrolling != 1) {
617 if (PRESENT(linefeed_if_not_lf))
618 cursor_down = linefeed_if_not_lf;
619 else if (linefeed_is_newline != 1) {
620 if (new_line_delay > 0) {
621 sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
622 scroll_forward = _nc_save_str(buf);
624 scroll_forward = _nc_save_str(C_LF);
627 if (WANTED(newline)) {
628 if (linefeed_is_newline == 1) {
629 if (new_line_delay > 0) {
630 sprintf(buf, "%s$<%d>", C_LF, new_line_delay);
631 newline = _nc_save_str(buf);
633 newline = _nc_save_str(C_LF);
634 } else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) {
635 strncpy(buf, carriage_return, MAX_LINE - 2);
636 buf[MAX_LINE - 1] = '\0';
637 strncat(buf, scroll_forward, MAX_LINE - strlen(buf) - 1);
638 buf[MAX_LINE] = '\0';
639 newline = _nc_save_str(buf);
640 } else if (PRESENT(carriage_return) && PRESENT(cursor_down)) {
641 strncpy(buf, carriage_return, MAX_LINE - 2);
642 buf[MAX_LINE - 1] = '\0';
643 strncat(buf, cursor_down, MAX_LINE - strlen(buf) - 1);
644 buf[MAX_LINE] = '\0';
645 newline = _nc_save_str(buf);
651 * Inverse of capdefaults.c code ends here.
652 * ----------------------------------------------------------------------
654 * TERMCAP-TO TERMINFO MAPPINGS FOR SOURCE TRANSLATION
656 * These translations will *not* be inverted by tgetent().
661 * We wait until now to decide if we've got a working cr because even
662 * one that doesn't work can be used for newline. Unfortunately the
663 * space allocated for it is wasted.
665 if (return_does_clr_eol == 1 || no_correctly_working_cr == 1)
666 carriage_return = ABSENT_STRING;
669 * Supposedly most termcap entries have ta now and '\t' is no longer a
670 * default, but it doesn't seem to be true...
673 if (horizontal_tab_delay > 0) {
674 sprintf(buf, "%s$<%d>", C_HT, horizontal_tab_delay);
675 tab = _nc_save_str(buf);
677 tab = _nc_save_str(C_HT);
679 if (init_tabs == ABSENT_NUMERIC && has_hardware_tabs == TRUE)
683 * Assume we can beep with ^G unless we're given bl@.
686 bell = _nc_save_str("\007");
690 * Translate the old termcap :pt: capability to it#8 + ht=\t
692 if (has_hardware_tabs == TRUE) {
693 if (init_tabs != 8 && init_tabs != ABSENT_NUMERIC)
694 _nc_warning("hardware tabs with a width other than 8: %d", init_tabs);
696 if (tab && _nc_capcmp(tab, C_HT))
697 _nc_warning("hardware tabs with a non-^I tab string %s",
701 tab = _nc_save_str(C_HT);
707 * Now translate the ko capability, if there is one. This
708 * isn't from mytinfo...
710 if (PRESENT(other_non_function_keys)) {
711 char *dp, *cp = strtok(other_non_function_keys, ",");
712 struct name_table_entry const *from_ptr;
713 struct name_table_entry const *to_ptr;
715 char buf2[MAX_TERMINFO_LENGTH];
718 /* we're going to use this for a special case later */
719 dp = strchr(other_non_function_keys, 'i');
720 foundim = dp && dp[1] == 'm';
722 /* look at each comma-separated capability in the ko string... */
724 for (ap = ko_xlate; ap->from; ap++)
725 if (strcmp(ap->from, cp) == 0)
728 _nc_warning("unknown capability `%s' in ko string", cp);
730 } else if (ap->to == CANCELLED_STRING) /* ignore it */
733 /* now we know we found a match in ko_table, so... */
735 from_ptr = _nc_find_entry(ap->from, _nc_cap_hash_table);
736 to_ptr = _nc_find_entry(ap->to, _nc_info_hash_table);
738 if (!from_ptr || !to_ptr) /* should never happen! */
739 _nc_err_abort("ko translation table is invalid, I give up");
741 if (WANTED(tp->Strings[from_ptr->nte_index])) {
742 _nc_warning("no value for ko capability %s", ap->from);
746 if (tp->Strings[to_ptr->nte_index]) {
747 /* There's no point in warning about it if it's the same
748 * string; that's just an inefficiency.
751 tp->Strings[from_ptr->nte_index],
752 tp->Strings[to_ptr->nte_index]) != 0)
753 _nc_warning("%s (%s) already has an explicit value %s, ignoring ko",
755 _nc_visbuf(tp->Strings[to_ptr->nte_index]));
760 * The magic moment -- copy the mapped key string over,
761 * stripping out padding.
764 for (cp = tp->Strings[from_ptr->nte_index]; *cp; cp++) {
765 if (cp[0] == '$' && cp[1] == '<') {
766 while (*cp && *cp != '>')
776 tp->Strings[to_ptr->nte_index] = _nc_save_str(buf2);
778 ((cp = strtok((char *) 0, ",")) != 0);
781 * Note: ko=im and ko=ic both want to grab the `Insert'
782 * keycap. There's a kich1 but no ksmir, so the ic capability
783 * got mapped to kich1 and im to kIC to avoid a collision.
784 * If the description has im but not ic, hack kIC back to kich1.
786 if (foundim && WANTED(key_ic) && key_sic) {
788 key_sic = ABSENT_STRING;
793 if (WANTED(key_backspace))
794 key_backspace = _nc_save_str(C_BS);
795 if (WANTED(key_left))
796 key_left = _nc_save_str(C_BS);
797 if (WANTED(key_down))
798 key_down = _nc_save_str(C_LF);
802 * Translate XENIX forms characters.
804 if (PRESENT(acs_ulcorner) ||
805 PRESENT(acs_llcorner) ||
806 PRESENT(acs_urcorner) ||
807 PRESENT(acs_lrcorner) ||
812 PRESENT(acs_hline) ||
813 PRESENT(acs_vline) ||
815 char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
818 (void) strcpy(bp, acs_chars);
822 if (acs_ulcorner && acs_ulcorner[1] == '\0') {
824 *bp++ = *acs_ulcorner;
826 if (acs_llcorner && acs_llcorner[1] == '\0') {
828 *bp++ = *acs_llcorner;
830 if (acs_urcorner && acs_urcorner[1] == '\0') {
832 *bp++ = *acs_urcorner;
834 if (acs_lrcorner && acs_lrcorner[1] == '\0') {
836 *bp++ = *acs_lrcorner;
838 if (acs_ltee && acs_ltee[1] == '\0') {
842 if (acs_rtee && acs_rtee[1] == '\0') {
846 if (acs_btee && acs_btee[1] == '\0') {
850 if (acs_ttee && acs_ttee[1] == '\0') {
854 if (acs_hline && acs_hline[1] == '\0') {
858 if (acs_vline && acs_vline[1] == '\0') {
864 strcpy(bp, acs_plus);
865 bp = buf2 + strlen(buf2);
870 acs_chars = _nc_save_str(buf2);
871 _nc_warning("acsc string synthesized from XENIX capabilities");
873 } else if (acs_chars == 0
874 && enter_alt_charset_mode != 0
875 && exit_alt_charset_mode != 0) {
877 _nc_save_str("``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~");
883 postprocess_terminfo(TERMTYPE * tp)
886 * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION
887 * ----------------------------------------------------------------------
891 * Translate AIX forms characters.
893 if (PRESENT(box_chars_1)) {
894 char buf2[MAX_TERMCAP_LENGTH], *bp = buf2;
897 (void) strcpy(bp, acs_chars);
901 if (box_chars_1[0]) { /* ACS_ULCORNER */
903 *bp++ = box_chars_1[0];
905 if (box_chars_1[1]) { /* ACS_HLINE */
907 *bp++ = box_chars_1[1];
909 if (box_chars_1[2]) { /* ACS_URCORNER */
911 *bp++ = box_chars_1[2];
913 if (box_chars_1[3]) { /* ACS_VLINE */
915 *bp++ = box_chars_1[3];
917 if (box_chars_1[4]) { /* ACS_LRCORNER */
919 *bp++ = box_chars_1[4];
921 if (box_chars_1[5]) { /* ACS_LLCORNER */
923 *bp++ = box_chars_1[5];
925 if (box_chars_1[6]) { /* ACS_TTEE */
927 *bp++ = box_chars_1[6];
929 if (box_chars_1[7]) { /* ACS_RTEE */
931 *bp++ = box_chars_1[7];
933 if (box_chars_1[8]) { /* ACS_BTEE */
935 *bp++ = box_chars_1[8];
937 if (box_chars_1[9]) { /* ACS_LTEE */
939 *bp++ = box_chars_1[9];
941 if (box_chars_1[10]) { /* ACS_PLUS */
943 *bp++ = box_chars_1[10];
948 acs_chars = _nc_save_str(buf2);
949 _nc_warning("acsc string synthesized from AIX capabilities");
950 box_chars_1 = ABSENT_STRING;
954 * ----------------------------------------------------------------------
959 * Do a linear search through the terminfo tables to find a given full-name.
960 * We don't expect to do this often, so there's no hashing function.
962 * In effect, this scans through the 3 lists of full-names, and looks them
963 * up in _nc_info_table, which is organized so that the nte_index fields are
964 * sorted, but the nte_type fields are not necessarily grouped together.
967 struct name_table_entry const *
968 lookup_fullname(const char *find)
974 NCURSES_CONST char *const *names;
990 for (count = 0; names[count] != 0; count++) {
991 if (!strcmp(names[count], find)) {
992 struct name_table_entry const *entry_ptr = _nc_get_table(FALSE);
993 while (entry_ptr->nte_type != state
994 || entry_ptr->nte_index != count)
1002 /* parse_entry.c ends here */