FreeCalypso > hg > themwi-system-sw
comparison utils/themwi-update-numdb2.c @ 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 |
comparison
equal
deleted
inserted
replaced
| 228:7ea6acdb8364 | 229:626824449ddf |
|---|---|
| 309 short_rec.short_num_type = SHORT_NUM_TYPE_ITN; | 309 short_rec.short_num_type = SHORT_NUM_TYPE_ITN; |
| 310 enter_short_number(&short_rec); | 310 enter_short_number(&short_rec); |
| 311 } | 311 } |
| 312 | 312 |
| 313 static void | 313 static void |
| 314 handle_test_sink_line(cp) | |
| 315 char *cp; | |
| 316 { | |
| 317 char *np; | |
| 318 struct short_number_rec short_rec; | |
| 319 | |
| 320 prefix_set = 0; /* cancel any previous prefix line */ | |
| 321 for (np = cp; *cp && !isspace(*cp); cp++) | |
| 322 ; | |
| 323 if (*cp) | |
| 324 *cp++ = '\0'; | |
| 325 if (grok_number_string(np, 0) != 4) { | |
| 326 fprintf(stderr, | |
| 327 "number-db2 line %d: test-sink requires 4-digit argument\n", | |
| 328 lineno); | |
| 329 exit(1); | |
| 330 } | |
| 331 bzero(&short_rec, sizeof short_rec); | |
| 332 short_rec.short_num = digits4_to_uint16(np); | |
| 333 short_rec.short_num_type = SHORT_NUM_TYPE_TEST_SINK; | |
| 334 enter_short_number(&short_rec); | |
| 335 } | |
| 336 | |
| 337 static void | |
| 314 process_line() | 338 process_line() |
| 315 { | 339 { |
| 316 char *cp, *np; | 340 char *cp, *np; |
| 317 void (*handler)(); | 341 void (*handler)(); |
| 318 | 342 |
| 336 handler = handle_suffix_line; | 360 handler = handle_suffix_line; |
| 337 else if (!strcmp(np, "full10")) | 361 else if (!strcmp(np, "full10")) |
| 338 handler = handle_full10_line; | 362 handler = handle_full10_line; |
| 339 else if (!strcmp(np, "itn")) | 363 else if (!strcmp(np, "itn")) |
| 340 handler = handle_itn_line; | 364 handler = handle_itn_line; |
| 365 else if (!strcmp(np, "test-sink")) | |
| 366 handler = handle_test_sink_line; | |
| 341 else { | 367 else { |
| 342 fprintf(stderr, | 368 fprintf(stderr, |
| 343 "number-db2 line %d: non-understood keyword \"%s\"\n", | 369 "number-db2 line %d: non-understood keyword \"%s\"\n", |
| 344 lineno, np); | 370 lineno, np); |
| 345 exit(1); | 371 exit(1); |
