- int i;
-
- T((T_CALLED("tigetnum(%s)"), str));
-
- if (cur_term != 0) {
- TERMTYPE *tp = &(cur_term->type);
- for_each_number(i, tp) {
- const char *capname = ExtNumname(tp, i, numnames);
- if (!strcmp(str, capname)) {
- if (!VALID_NUMERIC(tp->Numbers[i]))
- returnCode(ABSENT_NUMERIC);
- returnCode(tp->Numbers[i]);
+ int i, j;
+ 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 {
+ j = -1;
+ for_each_ext_number(i, tp) {
+ const char *capname = ExtNumname(tp, i, numnames);
+ if (same_name(str, capname)) {
+ j = i;
+ break;
+ }