+static void
+print_uses(ENTRY * ep, FILE *fp)
+/* print an entry's use references */
+{
+ unsigned i;
+
+ if (!ep->nuses)
+ fputs("NULL", fp);
+ else
+ for (i = 0; i < ep->nuses; i++) {
+ fputs(ep->uses[i].name, fp);
+ if (i < ep->nuses - 1)
+ fputs(" ", fp);
+ }
+}
+
+static const char *
+dump_boolean(int val)
+/* display the value of a boolean capability */
+{
+ switch (val) {
+ case ABSENT_BOOLEAN:
+ return (s_absent);
+ case CANCELLED_BOOLEAN:
+ return (s_cancel);
+ case FALSE:
+ return ("F");
+ case TRUE:
+ return ("T");
+ default:
+ return ("?");
+ }
+}
+
+static void
+dump_numeric(int val, char *buf)
+/* display the value of a numeric capability */
+{
+ switch (val) {
+ case ABSENT_NUMERIC:
+ _nc_STRCPY(buf, s_absent, MAX_STRING);
+ break;
+ case CANCELLED_NUMERIC:
+ _nc_STRCPY(buf, s_cancel, MAX_STRING);
+ break;
+ default:
+ _nc_SPRINTF(buf, _nc_SLIMIT(MAX_STRING) "%d", val);
+ break;
+ }
+}
+
+static void
+dump_string(char *val, char *buf)
+/* display the value of a string capability */
+{
+ if (val == ABSENT_STRING)
+ _nc_STRCPY(buf, s_absent, MAX_STRING);
+ else if (val == CANCELLED_STRING)
+ _nc_STRCPY(buf, s_cancel, MAX_STRING);
+ else {
+ _nc_SPRINTF(buf, _nc_SLIMIT(MAX_STRING)
+ "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val));
+ }
+}
+
+/*
+ * Show "comparing..." message for the given terminal names.
+ */
+static void
+show_comparing(char **names)
+{
+ if (itrace) {
+ switch (compare) {
+ case C_DIFFERENCE:
+ (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname);
+ break;
+
+ case C_COMMON:
+ (void) fprintf(stderr, "%s: dumping common capabilities\n", _nc_progname);
+ break;
+
+ case C_NAND:
+ (void) fprintf(stderr, "%s: dumping differences\n", _nc_progname);
+ break;
+ }
+ }
+ if (*names) {
+ printf("comparing %s", *names++);
+ if (*names) {
+ printf(" to %s", *names++);
+ while (*names) {
+ printf(", %s", *names++);
+ }
+ }
+ printf(".\n");
+ }
+}
+
+/*
+ * ncurses stores two types of non-standard capabilities:
+ * a) capabilities listed past the "STOP-HERE" comment in the Caps file.
+ * These are used in the terminfo source file to provide data for termcaps,
+ * e.g., when there is no equivalent capability in terminfo, as well as for
+ * widely-used non-standard capabilities.
+ * b) user-definable capabilities, via "tic -x".
+ *
+ * However, if "-x" is omitted from the tic command, both types of
+ * non-standard capability are not loaded into the terminfo database. This
+ * macro is used for limit-checks against the symbols that tic uses to omit
+ * the two types of non-standard entry.
+ */
+#if NCURSES_XNAMES
+#define check_user_definable(n,limit) if (!_nc_user_definable && (n) > (limit)) break
+#else
+#define check_user_definable(n,limit) if ((n) > (limit)) break
+#endif
+
+/*
+ * Use these macros to simplify loops on C_COMMON and C_NAND:
+ */
+#define for_each_entry() while (entries[extra].tterm.term_names)
+#define next_entry (&(entries[extra++].tterm))
+
+static void
+compare_predicate(PredType type, PredIdx idx, const char *name)