NCURSES_SP_NAME(tgetflag) (NCURSES_SP_DCLx NCURSES_CONST char *id) { int result = 0; /* Solaris returns zero for missing flag */ T((T_CALLED("tgetflag(%p, %s)"), (void *) SP_PARM, id)); if (HasTInfoTerminal(SP_PARM) && ValidCap(id)) { TERMTYPE2 *tp = &TerminalType(TerminalOf(SP_PARM)); struct name_table_entry const *entry_ptr; int j = -1; entry_ptr = _nc_find_type_entry(id, BOOLEAN, TRUE); if (entry_ptr != 0) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES else { int i; for_each_ext_boolean(i, tp) { const char *capname = ExtBoolname(tp, i, boolcodes); if (same_tcname(id, capname) && ValidExt(capname)) { j = i; break; } } } #endif if (j >= 0) { /* note: setupterm forces invalid booleans to false */ result = tp->Booleans[j]; } }
NCURSES_SP_NAME(tigetflag) (NCURSES_SP_DCLx NCURSES_CONST char *str) { int result = ABSENT_BOOLEAN; int j = -1; T((T_CALLED("tigetflag(%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, BOOLEAN, FALSE); if (entry_ptr != 0) { j = entry_ptr->nte_index; } #if NCURSES_XNAMES else { int i; for_each_ext_boolean(i, tp) { const char *capname = ExtBoolname(tp, i, boolnames); if (same_name(str, capname)) { j = i; break; } } } #endif if (j >= 0) { /* note: setupterm forces invalid booleans to false */ result = tp->Booleans[j]; } } returnCode(result); }
tgetflag(NCURSES_CONST char *id) { unsigned i; T((T_CALLED("tgetflag(%s)"), id)); if (cur_term != 0) { TERMTYPE *tp = &(cur_term->type); for_each_boolean(i, tp) { const char *capname = ExtBoolname(tp, i, boolcodes); if (!strncmp(id, capname, 2)) { /* setupterm forces invalid booleans to false */ returnCode(tp->Booleans[i]); } } }
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 }