ncurses 5.6 - patch 20070901
[ncurses.git] / ncurses / tinfo / lib_ti.c
index 7b2b2f910f2d34131dc2d24c203f59549d949384..df460f953ea71aa081ee0e8e397c7b802dddd826 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ * Copyright (c) 1998-2000,2003 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            *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
  ****************************************************************************/
 
-
 #include <curses.priv.h>
 
 #include <term_entry.h>
 #include <tic.h>
 
-MODULE_ID("$Id: lib_ti.c,v 1.16 1999/02/28 23:11:28 tom Exp $")
+MODULE_ID("$Id: lib_ti.c,v 1.23 2003/05/24 21:10:28 tom Exp $")
 
-int tigetflag(NCURSES_CONST char *str)
+NCURSES_EXPORT(int)
+tigetflag(NCURSES_CONST char *str)
 {
-int i;
-
-       T((T_CALLED("tigetflag(%s)"), str));
-
-       if (cur_term != 0) {
-           TERMTYPE *tp = &(cur_term->type);
-           for_each_boolean(i,tp) {
-               const char *capname = ExtBoolname(tp, i, boolnames);
-               if (!strcmp(str, capname)) {
-                   /* setupterm forces invalid booleans to false */
-                   returnCode(tp->Booleans[i]);
-               }
+    unsigned i;
+
+    T((T_CALLED("tigetflag(%s)"), str));
+
+    if (cur_term != 0) {
+       TERMTYPE *tp = &(cur_term->type);
+       for_each_boolean(i, tp) {
+           const char *capname = ExtBoolname(tp, i, boolnames);
+           if (!strcmp(str, capname)) {
+               /* setupterm forces invalid booleans to false */
+               returnCode(tp->Booleans[i]);
            }
        }
+    }
 
-       returnCode(ABSENT_BOOLEAN);
+    returnCode(ABSENT_BOOLEAN);
 }
 
-int tigetnum(NCURSES_CONST char *str)
+NCURSES_EXPORT(int)
+tigetnum(NCURSES_CONST char *str)
 {
-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]))
-                       return -1;
-                   returnCode(tp->Numbers[i]);
-               }
+    unsigned 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]);
            }
        }
+    }
 
-       returnCode(CANCELLED_NUMERIC);  /* Solaris returns a -1 instead */
+    returnCode(CANCELLED_NUMERIC);     /* Solaris returns a -1 instead */
 }
 
-char *tigetstr(NCURSES_CONST char *str)
+NCURSES_EXPORT(char *)
+tigetstr(NCURSES_CONST char *str)
 {
-int i;
-
-       T((T_CALLED("tigetstr(%s)"), str));
-
-       if (cur_term != 0) {
-           TERMTYPE *tp = &(cur_term->type);
-           for_each_string(i, tp) {
-               const char *capname = ExtStrname(tp, i, strnames);
-               if (!strcmp(str, capname)) {
-                   /* setupterm forces cancelled strings to null */
-                   returnPtr(tp->Strings[i]);
-               }
+    unsigned i;
+
+    T((T_CALLED("tigetstr(%s)"), str));
+
+    if (cur_term != 0) {
+       TERMTYPE *tp = &(cur_term->type);
+       for_each_string(i, tp) {
+           const char *capname = ExtStrname(tp, i, strnames);
+           if (!strcmp(str, capname)) {
+               /* setupterm forces cancelled strings to null */
+               returnPtr(tp->Strings[i]);
            }
        }
+    }
 
-       returnPtr(CANCELLED_STRING);
+    returnPtr(CANCELLED_STRING);
 }