]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_termcap.c
ncurses 5.9 - patch 20130209
[ncurses.git] / test / demo_termcap.c
index eede682fdbe8be28b1801fef937118e599991ff0..50b56c5ac0b4233eeaa5c54921a81f394e882cd6 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2011,2012 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-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            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_termcap.c,v 1.21 2012/06/30 22:02:56 tom Exp $
+ * $Id: demo_termcap.c,v 1.23 2013/01/19 19:30:52 tom Exp $
  *
  * A simple demo of the termcap interface.
  */
@@ -89,7 +89,7 @@ static char *
 make_dbitem(char *p, char *q)
 {
     char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q));
-    sprintf(result, "%s=%.*s", e_opt, p - q, q);
+    sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q);
     return result;
 }
 
@@ -337,6 +337,9 @@ usage(void)
        " -q       quiet (prints only counts)",
        " -r COUNT repeat for given count",
        " -s       print string-capabilities",
+#ifdef NCURSES_VERSION
+       " -y       disable extended capabilities",
+#endif
     };
     unsigned n;
     for (n = 0; n < SIZEOF(msg); ++n) {
@@ -357,7 +360,7 @@ main(int argc, char *argv[])
     int repeat;
     int r_opt = 1;
 
-    while ((n = getopt(argc, argv, "abd:e:nqr:s")) != -1) {
+    while ((n = getopt(argc, argv, "abd:e:nqr:sy")) != -1) {
        switch (n) {
        case 'a':
            a_opt = TRUE;
@@ -384,6 +387,11 @@ main(int argc, char *argv[])
        case 's':
            s_opt = TRUE;
            break;
+#ifdef NCURSES_VERSION
+       case 'y':
+           use_extended_names(FALSE);
+           break;
+#endif
        default:
            usage();
            break;