+#if USE_CODE_LISTS
+static void
+demo_terminfo(NCURSES_CONST char *name)
+{
+ unsigned n;
+ NCURSES_CONST char *cap;
+
+ printf("Terminal type \"%s\"\n", name);
+ setupterm(name, 1, (int *) 0);
+
+ if (b_opt) {
+ for (n = 0;; ++n) {
+ cap = boolcodes[n];
+ if (cap == 0)
+ break;
+ dumpit(cap);
+ }
+ }
+
+ if (n_opt) {
+ for (n = 0;; ++n) {
+ cap = numcodes[n];
+ if (cap == 0)
+ break;
+ dumpit(cap);
+ }
+ }
+
+ if (s_opt) {
+ for (n = 0;; ++n) {
+ cap = strcodes[n];
+ if (cap == 0)
+ break;
+ dumpit(cap);
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ static const char *msg[] =
+ {
+ "Usage: demo_terminfo [options] [terminal]",
+ "",
+ "If no options are given, print all (boolean, numeric, string)",
+ "capabilities for the given terminal, using short names.",
+ "",
+ "Options:",
+ " -a try all names, print capabilities found",
+ " -b print boolean-capabilities",
+ " -n print numeric-capabilities",
+ " -r COUNT repeat for given count",
+ " -s print string-capabilities",
+ };
+ unsigned n;
+ for (n = 0; n < SIZEOF(msg); ++n) {
+ fprintf(stderr, "%s\n", msg[n]);
+ }
+ ExitProgram(EXIT_FAILURE);
+}
+#endif
+