+static void
+dump_plain(void)
+{
+ PLAIN(opt_T && opt_n, boolnames);
+ PLAIN(opt_C && opt_c, boolcodes);
+ PLAIN(opt_T && opt_f, boolfnames);
+
+ PLAIN(opt_T && opt_n, numnames);
+ PLAIN(opt_C && opt_c, numcodes);
+ PLAIN(opt_T && opt_f, numfnames);
+
+ PLAIN(opt_T && opt_n, strnames);
+ PLAIN(opt_C && opt_c, strcodes);
+ PLAIN(opt_T && opt_f, strfnames);
+}
+
+#define STRING(opts, name) if (opts) { printf("%s\"%s\"", c++ ? "," : "", name); }
+#define NUMBER(opts, value) if (opts) { printf("%s%d", c++ ? "," : "", value); }
+
+static void
+dump_table(void)
+{
+ int c = 0;
+ int r;
+
+ STRING(opt_t, "Index");
+ STRING(opt_t, "Type");
+ STRING(opt_n, "Name");
+ STRING(opt_c, "Code");
+ STRING(opt_f, "FName");
+ printf("\n");
+
+ for (r = 0; boolnames[r]; ++r) {
+ c = 0;
+ NUMBER(opt_t, r);
+ STRING(opt_t, "bool");
+ STRING(opt_T && opt_n, boolnames[r]);
+ STRING(opt_C && opt_c, boolcodes[r]);
+ STRING(opt_T && opt_f, boolfnames[r]);
+ printf("\n");
+ }
+
+ for (r = 0; numnames[r]; ++r) {
+ c = 0;
+ NUMBER(opt_t, r);
+ STRING(opt_t, "num");
+ STRING(opt_T && opt_n, numnames[r]);
+ STRING(opt_C && opt_c, numcodes[r]);
+ STRING(opt_T && opt_f, numfnames[r]);
+ printf("\n");
+ }
+
+ for (r = 0; strnames[r]; ++r) {
+ c = 0;
+ NUMBER(opt_t, r);
+ STRING(opt_t, "str");
+ STRING(opt_T && opt_n, strnames[r]);
+ STRING(opt_C && opt_c, strcodes[r]);
+ STRING(opt_T && opt_f, strfnames[r]);
+ printf("\n");
+ }
+}
+
+static void
+usage(int ok)
+{
+ static const char *msg[] =
+ {
+ "Usage: test_arrays [options]"
+ ,""
+ ,"If no options are given, print all (boolean, numeric, string)"
+ ,"capability names showing their index within the tables."
+ ,""
+ ,USAGE_COMMON
+ ,"Options:"
+ ," -C print termcap names"
+ ," -T print terminfo names"
+ ," -c print termcap names"
+ ," -f print full terminfo names"
+ ," -n print short terminfo names"
+ ," -t print the result as CSV table"
+ };
+ unsigned n;
+ for (n = 0; n < SIZEOF(msg); ++n) {
+ fprintf(stderr, "%s\n", msg[n]);
+ }
+ ExitProgram(ok ? EXIT_SUCCESS : EXIT_FAILURE);
+}
+/* *INDENT-OFF* */
+VERSION_COMMON()
+/* *INDENT-ON* */
+