]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_terminfo.c
ncurses 5.7 - patch 20110212
[ncurses.git] / test / demo_terminfo.c
index d045fb750404cd574f716dab20bc776bbfdd4914..2ee5b4c40857a64e9ab831da6a0ee3c46ee2c23d 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2009,2010 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            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_terminfo.c,v 1.5 2009/07/11 17:39:41 tom Exp $
+ * $Id: demo_terminfo.c,v 1.9 2010/11/28 00:15:27 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
 #include <test.priv.h>
 
 #ifdef NCURSES_VERSION
+#if !(defined(HAVE_TERM_ENTRY_H) && HAVE_TERM_ENTRY_H)
+#undef NCURSES_XNAMES
+#define NCURSES_XNAMES 0
+#endif
 #if NCURSES_XNAMES
 #include <term_entry.h>
 #endif
 #endif
 
+#if HAVE_TIGETSTR
+#if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES)
+
 static bool b_opt = FALSE;
 static bool f_opt = FALSE;
 static bool n_opt = FALSE;
@@ -173,13 +180,13 @@ demo_terminfo(char *name)
                    || (NUM_NUMBERS(term) != NUMCOUNT)
                    || (NUM_STRINGS(term) != STRCOUNT))) {
                for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) {
-                   dumpit(ExtBoolname(term, n, boolnames));
+                   dumpit(ExtBoolname(term, (int) n, boolnames));
                }
                for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) {
-                   dumpit(ExtNumname(term, n, numnames));
+                   dumpit(ExtNumname(term, (int) n, numnames));
                }
                for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
-                   dumpit(ExtStrname(term, n, strnames));
+                   dumpit(ExtStrname(term, (int) n, strnames));
                }
            }
 #endif
@@ -291,3 +298,20 @@ main(int argc, char *argv[])
 
     ExitProgram(EXIT_SUCCESS);
 }
+
+#else
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    printf("This program requires the terminfo arrays\n");
+    ExitProgram(EXIT_FAILURE);
+}
+#endif
+#else /* !HAVE_TIGETSTR */
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    printf("This program requires the terminfo functions such as tigetstr\n");
+    ExitProgram(EXIT_FAILURE);
+}
+#endif /* HAVE_TIGETSTR */