changeset 229:626824449ddf

themwi-update-numdb2: add test-sink support
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 14 Aug 2023 10:41:23 -0800
parents 7ea6acdb8364
children 803829e6244f
files utils/themwi-update-numdb2.c
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/utils/themwi-update-numdb2.c	Mon Aug 14 10:29:22 2023 -0800
+++ b/utils/themwi-update-numdb2.c	Mon Aug 14 10:41:23 2023 -0800
@@ -311,6 +311,30 @@
 }
 
 static void
+handle_test_sink_line(cp)
+	char *cp;
+{
+	char *np;
+	struct short_number_rec short_rec;
+
+	prefix_set = 0;		/* cancel any previous prefix line */
+	for (np = cp; *cp && !isspace(*cp); cp++)
+		;
+	if (*cp)
+		*cp++ = '\0';
+	if (grok_number_string(np, 0) != 4) {
+		fprintf(stderr,
+		"number-db2 line %d: test-sink requires 4-digit argument\n",
+			lineno);
+		exit(1);
+	}
+	bzero(&short_rec, sizeof short_rec);
+	short_rec.short_num = digits4_to_uint16(np);
+	short_rec.short_num_type = SHORT_NUM_TYPE_TEST_SINK;
+	enter_short_number(&short_rec);
+}
+
+static void
 process_line()
 {
 	char *cp, *np;
@@ -338,6 +362,8 @@
 		handler = handle_full10_line;
 	else if (!strcmp(np, "itn"))
 		handler = handle_itn_line;
+	else if (!strcmp(np, "test-sink"))
+		handler = handle_test_sink_line;
 	else {
 		fprintf(stderr,
 			"number-db2 line %d: non-understood keyword \"%s\"\n",