]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_ti.c
ncurses 5.7 - patch 20090627
[ncurses.git] / ncurses / tinfo / lib_ti.c
index 8ef8665881974166afd31d84a417a7ce0e49a8b9..355310ec778cecae99259ae9b96a4aa02ba4559d 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2003,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
 #include <term_entry.h>
 #include <tic.h>
 
-MODULE_ID("$Id: lib_ti.c,v 1.22 2000/12/10 02:55:08 tom Exp $")
+MODULE_ID("$Id: lib_ti.c,v 1.24 2009/04/18 17:37:50 tom Exp $")
 
 NCURSES_EXPORT(int)
-tigetflag(NCURSES_CONST char *str)
+NCURSES_SP_NAME(tigetflag) (NCURSES_SP_DCLx NCURSES_CONST char *str)
 {
-    int i;
+    unsigned i;
 
-    T((T_CALLED("tigetflag(%s)"), str));
+    T((T_CALLED("tigetflag(%p, %s)"), SP_PARM, str));
 
-    if (cur_term != 0) {
-       TERMTYPE *tp = &(cur_term->type);
+    if (HasTInfoTerminal(SP_PARM)) {
+       TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
        for_each_boolean(i, tp) {
            const char *capname = ExtBoolname(tp, i, boolnames);
            if (!strcmp(str, capname)) {
@@ -59,15 +59,23 @@ tigetflag(NCURSES_CONST char *str)
     returnCode(ABSENT_BOOLEAN);
 }
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(int)
-tigetnum(NCURSES_CONST char *str)
+tigetflag(NCURSES_CONST char *str)
 {
-    int i;
+    return NCURSES_SP_NAME(tigetflag) (CURRENT_SCREEN, str);
+}
+#endif
 
-    T((T_CALLED("tigetnum(%s)"), str));
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(tigetnum) (NCURSES_SP_DCLx NCURSES_CONST char *str)
+{
+    unsigned i;
+
+    T((T_CALLED("tigetnum(%p, %s)"), SP_PARM, str));
 
-    if (cur_term != 0) {
-       TERMTYPE *tp = &(cur_term->type);
+    if (HasTInfoTerminal(SP_PARM)) {
+       TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
        for_each_number(i, tp) {
            const char *capname = ExtNumname(tp, i, numnames);
            if (!strcmp(str, capname)) {
@@ -81,15 +89,23 @@ tigetnum(NCURSES_CONST char *str)
     returnCode(CANCELLED_NUMERIC);     /* Solaris returns a -1 instead */
 }
 
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+tigetnum(NCURSES_CONST char *str)
+{
+    return NCURSES_SP_NAME(tigetnum) (CURRENT_SCREEN, str);
+}
+#endif
+
 NCURSES_EXPORT(char *)
-tigetstr(NCURSES_CONST char *str)
+NCURSES_SP_NAME(tigetstr) (NCURSES_SP_DCLx NCURSES_CONST char *str)
 {
-    int i;
+    unsigned i;
 
-    T((T_CALLED("tigetstr(%s)"), str));
+    T((T_CALLED("tigetstr(%p, %s)"), SP_PARM, str));
 
-    if (cur_term != 0) {
-       TERMTYPE *tp = &(cur_term->type);
+    if (HasTInfoTerminal(SP_PARM)) {
+       TERMTYPE *tp = &(TerminalOf(SP_PARM)->type);
        for_each_string(i, tp) {
            const char *capname = ExtStrname(tp, i, strnames);
            if (!strcmp(str, capname)) {
@@ -101,3 +117,11 @@ tigetstr(NCURSES_CONST char *str)
 
     returnPtr(CANCELLED_STRING);
 }
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(char *)
+tigetstr(NCURSES_CONST char *str)
+{
+    return NCURSES_SP_NAME(tigetstr) (CURRENT_SCREEN, str);
+}
+#endif