X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fdemo_terminfo.c;h=239739a47a8f36ac5fedf05d932d257677070df2;hp=d9bf5540b60f0c9df221debfe737b76d55f982ee;hb=17d9459c7aecedecbfc59b8ba5d29279a01e9003;hpb=938680fa3bc29d2a086031a2f648dfd6cadcb51e diff --git a/test/demo_terminfo.c b/test/demo_terminfo.c index d9bf5540..239739a4 100644 --- a/test/demo_terminfo.c +++ b/test/demo_terminfo.c @@ -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 * @@ -29,20 +29,19 @@ /* * 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 -#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 +#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;