+
+ if (n_opt) {
+ for (n = 0;; ++n) {
+ cap = my_numcodes[n];
+ if (cap == 0)
+ break;
+ dumpit(cap);
+ }
+ }
+
+ if (s_opt) {
+ for (n = 0;; ++n) {
+ cap = my_strcodes[n];
+ if (cap == 0)
+ break;
+ dumpit(cap);
+ }
+ }
+#ifdef NCURSES_VERSION
+ if (x_opt && (my_blob == 0) && y_opt) {
+#if NCURSES_XNAMES
+ TERMTYPE *term = (TERMTYPE *) cur_term;
+ if (term != 0
+ && ((NUM_BOOLEANS(term) != BOOLCOUNT)
+ || (NUM_NUMBERS(term) != NUMCOUNT)
+ || (NUM_STRINGS(term) != STRCOUNT))) {
+ for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) {
+ dump_xname(ExtBoolname(term, (int) n, boolnames));
+ }
+ for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) {
+ dump_xname(ExtNumname(term, (int) n, numnames));
+ }
+ for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
+ dump_xname(ExtStrname(term, (int) n, strnames));
+ }
+ }
+#endif
+ }
+#endif
+ }
+}
+
+typedef enum {
+ pDefault = 0
+ ,pComment
+ ,pDescription
+ ,pEscaped
+ ,pNewline
+ ,pName
+ ,pNumber
+ ,pString
+} STATE;
+
+static void
+parse_description(const char *input_name)
+{
+ static char empty[1];
+
+ FILE *fp;
+ struct stat sb;
+ size_t count_bools = 0;
+ size_t count_nums = 0;
+ size_t count_strs = 0;
+ size_t len;
+ size_t j, k;
+ STATE state;
+
+ if (stat(input_name, &sb) != 0
+ || (sb.st_mode & S_IFMT) != S_IFREG) {
+ failed("input is not a file");
+ }
+
+ if (sb.st_size == 0) {
+ failed("input is empty");
+ }
+
+ /*
+ * None of the arrays could be larger than the input-file, and since it
+ * is small, just allocate the maximum for simplicity.
+ */
+ if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0 ||
+ (my_boolcodes = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_numcodes = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_numvalues = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_strcodes = typeCalloc(char *, sb.st_size)) == 0 ||
+ (my_strvalues = typeCalloc(char *, sb.st_size)) == 0) {
+ failed("cannot allocate memory for input-file");