]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_terminfo.c
ncurses 5.9 - patch 20140629
[ncurses.git] / test / demo_terminfo.c
index d9bf5540b60f0c9df221debfe737b76d55f982ee..239739a47a8f36ac5fedf05d932d257677070df2 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2009-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright (c) 2009-2012,2013 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            *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_terminfo.c,v 1.15 2012/12/29 23:36:22 tom Exp $
+ * $Id: demo_terminfo.c,v 1.19 2013/09/28 21:50:01 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
 #define USE_TINFO
 #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
+#if HAVE_TERM_ENTRY_H
 #include <term_entry.h>
+#else
+#undef NCURSES_XNAMES
+#define NCURSES_XNAMES 0
 #endif
 #endif
 
@@ -325,6 +324,7 @@ usage(void)
        " -s       print string-capabilities",
 #ifdef NCURSES_VERSION
        " -x       print extended capabilities",
+       " -y       disable extended capabilities",
 #endif
     };
     unsigned n;
@@ -341,8 +341,11 @@ main(int argc, char *argv[])
     int repeat;
     char *name;
     int r_opt = 1;
+#ifdef NCURSES_VERSION
+    bool xy_opt = TRUE;                /* by default, use_extended_names is true */
+#endif
 
-    while ((n = getopt(argc, argv, "bd:e:fnqr:sx")) != -1) {
+    while ((n = getopt(argc, argv, "bd:e:fnqr:sxy")) != -1) {
        switch (n) {
        case 'b':
            b_opt = TRUE;
@@ -372,7 +375,10 @@ main(int argc, char *argv[])
 #ifdef NCURSES_VERSION
        case 'x':
            x_opt = TRUE;
-           use_extended_names(TRUE);
+           xy_opt = TRUE;
+           break;
+       case 'y':
+           xy_opt = FALSE;
            break;
 #endif
        default:
@@ -381,6 +387,10 @@ main(int argc, char *argv[])
        }
     }
 
+#if NCURSES_XNAMES
+    use_extended_names(xy_opt);
+#endif
+
     if (!(b_opt || n_opt || s_opt || x_opt)) {
        b_opt = TRUE;
        n_opt = TRUE;