NCURSES_SP_NAME(tgetnum) (NCURSES_SP_DCLx NCURSES_CONST char *id) { int result = ABSENT_NUMERIC; int i, j; T((T_CALLED("tgetnum(%p, %s)"), (void *) SP_PARM, id)); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); struct name_table_entry const *entry_ptr; entry_ptr = _nc_find_type_entry(id, NUMBER, TRUE); if (entry_ptr != 0) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES else { j = -1; for_each_ext_number(i, tp) { const char *capname = ExtNumname(tp, i, numcodes); if (same_tcname(id, capname)) { j = i; break; } } } #endif if (j >= 0) { if (VALID_NUMERIC(tp->Numbers[j])) result = tp->Numbers[j]; } } returnCode(result); }
NCURSES_SP_NAME(tigetnum) (NCURSES_SP_DCLx NCURSES_CONST char *str) { int j = -1; int result = CANCELLED_NUMERIC; /* Solaris returns a -1 on error */ T((T_CALLED("tigetnum(%p, %s)"), (void *) SP_PARM, str)); if (HasTInfoTerminal(SP_PARM)) { TERMTYPE *tp = &(TerminalOf(SP_PARM)->type); struct name_table_entry const *entry_ptr; entry_ptr = _nc_find_type_entry(str, NUMBER, FALSE); if (entry_ptr != 0) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES else { int i; for_each_ext_number(i, tp) { const char *capname = ExtNumname(tp, i, numnames); if (same_name(str, capname)) { j = i; break; } } } #endif if (j >= 0) { if (VALID_NUMERIC(tp->Numbers[j])) result = tp->Numbers[j]; else result = ABSENT_NUMERIC; } } returnCode(result); }
static void demo_terminfo(char *name) { unsigned n; NCURSES_CONST char *cap; printf("Terminal type \"%s\"\n", name); setupterm(name, 1, (int *) 0); if (b_opt) { for (n = 0;; ++n) { cap = f_opt ? boolfnames[n] : boolnames[n]; if (cap == 0) break; dumpit(cap); } } if (n_opt) { for (n = 0;; ++n) { cap = f_opt ? numfnames[n] : numnames[n]; if (cap == 0) break; dumpit(cap); } } if (s_opt) { for (n = 0;; ++n) { cap = f_opt ? strfnames[n] : strnames[n]; if (cap == 0) break; dumpit(cap); } } #ifdef NCURSES_VERSION if (x_opt) { int mod; if (f_opt) { #if NCURSES_XNAMES TERMTYPE *term = &(cur_term->type); if (term != 0 && ((NUM_BOOLEANS(term) != BOOLCOUNT) || (NUM_NUMBERS(term) != NUMCOUNT) || (NUM_STRINGS(term) != STRCOUNT))) { for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { dumpit(ExtBoolname(term, (int) n, boolnames)); } for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { dumpit(ExtNumname(term, (int) n, numnames)); } for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { dumpit(ExtStrname(term, (int) n, strnames)); } } #endif } else { char temp[10]; static const char *xterm_keys[] = { "kDC", "kDN", "kEND", "kHOM", "kIC", "kLFT", "kNXT", "kPRV", "kRIT", "kUP", }; for (n = 0; n < SIZEOF(xterm_keys); ++n) { for (mod = 0; mod < 8; ++mod) { if (mod == 0) strcpy(temp, xterm_keys[n]); else sprintf(temp, "%s%d", xterm_keys[n], mod); dumpit(temp); } } } } #endif }