annotate utils/themwi-update-numdb2.c @ 258:aab047d9efcb

top Makefile: sip-out depends on libnumdb2 now
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 15 Aug 2023 10:54:16 -0800
parents abb3f415b9dd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
2 * This program reads (parses) ThemWi config file /var/gsm/number-db2,
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * generates the compiled binary form of this database, and then makes
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * it live via atomic rename.
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <ctype.h>
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdint.h>
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdlib.h>
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <string.h>
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <strings.h>
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <unistd.h>
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
14 #include "../include/number_db_v2.h"
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define MAX_OWNED_NUMBERS 1000
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #define MAX_SHORT_NUMBERS 1000
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
19 static struct owned_number_rec owned_number_buf[MAX_OWNED_NUMBERS];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
20 static struct short_number_rec short_number_buf[MAX_SHORT_NUMBERS];
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 static unsigned owned_number_count, short_number_count;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 static char *system_dir;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 static FILE *inf;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 static int lineno;
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
26 static char linebuf[256];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
27 static int prefix_set, prefix_allows_abbrev;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
28 static uint16_t prefix_buf[2];
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 static void
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
31 enter_owned_number(rec)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
32 struct owned_number_rec *rec;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 if (owned_number_count >= MAX_OWNED_NUMBERS) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 fprintf(stderr, "error: MAX_OWNED_NUMBERS exceeded\n");
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
38 bcopy(rec, owned_number_buf + owned_number_count,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
39 sizeof(struct owned_number_rec));
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
40 owned_number_count++;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 static void
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
44 enter_short_number(rec)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
45 struct short_number_rec *rec;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 if (short_number_count >= MAX_SHORT_NUMBERS) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 fprintf(stderr, "error: MAX_SHORT_NUMBERS exceeded\n");
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
51 bcopy(rec, short_number_buf + short_number_count,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
52 sizeof(struct short_number_rec));
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 short_number_count++;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 static void
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 handle_prefix_line(cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 char *cp;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
60 char *np, prefix[7];
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 for (np = cp; *cp && !isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 if (*cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 *cp++ = '\0';
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 if (grok_number_string(np, 1) != 6) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
68 "number-db2 line %d: prefix requires 6-digit argument\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 dehyphen_number_string(np, prefix);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 if (!is_nanp_valid_prefix(prefix)) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
75 "number-db2 line %d: prefix violates NANP rules\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
79 prefix_buf[0] = digits3_to_uint16(prefix);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
80 prefix_buf[1] = digits3_to_uint16(prefix + 3);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
81 prefix_set = 1;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 while (isspace(*cp))
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 cp++;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 if (*cp == '\0' || *cp == '#') {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 prefix_allows_abbrev = 0;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 return;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 for (np = cp; *cp && !isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 if (*cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 *cp++ = '\0';
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 if (!strcmp(np, "allow-abbrev")) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 prefix_allows_abbrev = 1;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 return;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
97 "number-db2 line %d: non-understood notation \"%s\" after prefix\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 lineno, np);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
102 static int
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
103 parse_extra_number(rec, numstr)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
104 struct owned_number_rec *rec;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
105 char *numstr;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
106 {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
107 char buf[11];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
108 int rc;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
109
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
110 rc = grok_number_string(numstr, 1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
111 switch (rc) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
112 case 4:
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
113 if (!prefix_set)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
114 return(-1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
115 dehyphen_number_string(numstr, buf);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
116 rec->remap[0] = prefix_buf[0];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
117 rec->remap[1] = prefix_buf[1];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
118 rec->remap[2] = digits4_to_uint16(buf);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
119 return(0);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
120 case 10:
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
121 dehyphen_number_string(numstr, buf);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
122 rec->remap[0] = digits3_to_uint16(buf);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
123 rec->remap[1] = digits3_to_uint16(buf + 3);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
124 rec->remap[2] = digits4_to_uint16(buf + 6);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
125 return(0);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
126 default:
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
127 return(-1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
128 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
129 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
130
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
131 static void
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
132 handle_number_attr(rec, tail)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
133 struct owned_number_rec *rec;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
134 char *tail;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
135 {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
136 char *cp, *np;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
137 int rc;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
138
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
139 for (cp = tail; ; ) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
140 while (isspace(*cp))
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
141 cp++;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
142 if (*cp == '\0' || *cp == '#')
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
143 return;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
144 for (np = cp; *cp && !isspace(*cp); cp++)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
145 ;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
146 if (*cp)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
147 *cp++ = '\0';
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
148 if (!strcmp(np, "sms"))
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
149 rec->number_flags |= NUMBER_FLAG_SMSPROV;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
150 else if (!strcmp(np, "e911"))
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
151 rec->number_flags |= NUMBER_FLAG_E911PROV;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
152 else if (!strcmp(np, "gsm-sub"))
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
153 rec->usage = NUMBER_USAGE_TYPE_GSM_SUB;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
154 else if (!strcmp(np, "map-to")) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
155 rec->usage = NUMBER_USAGE_TYPE_ALIAS;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
156 while (isspace(*cp))
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
157 cp++;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
158 if (*cp == '\0' || *cp == '#') {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
159 fprintf(stderr,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
160 "number-db2 line %d: map-to requires an argument\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
161 lineno);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
162 exit(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
163 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
164 for (np = cp; *cp && !isspace(*cp); cp++)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
165 ;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
166 if (*cp)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
167 *cp++ = '\0';
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
168 rc = parse_extra_number(rec, np);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
169 if (rc < 0) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
170 fprintf(stderr,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
171 "number-db2 line %d: map-to argument is invalid\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
172 lineno);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
173 exit(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
174 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
175 } else if (!strcmp(np, "e911-via")) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
176 if (rec->usage != NUMBER_USAGE_TYPE_GSM_SUB) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
177 fprintf(stderr,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
178 "number-db2 line %d: invalid usage of e911-via\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
179 lineno);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
180 exit(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
181 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
182 rec->usage |= NUMBER_USAGE_FLAG_E911_VIA;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
183 while (isspace(*cp))
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
184 cp++;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
185 if (*cp == '\0' || *cp == '#') {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
186 fprintf(stderr,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
187 "number-db2 line %d: e911-via requires an argument\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
188 lineno);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
189 exit(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
190 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
191 for (np = cp; *cp && !isspace(*cp); cp++)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
192 ;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
193 if (*cp)
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
194 *cp++ = '\0';
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
195 rc = parse_extra_number(rec, np);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
196 if (rc < 0) {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
197 fprintf(stderr,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
198 "number-db2 line %d: e911-via argument is invalid\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
199 lineno);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
200 exit(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
201 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
202 } else {
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
203 fprintf(stderr,
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
204 "number-db2 line %d: invalid attribute \"%s\"\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
205 lineno, np);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
206 exit(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
207 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
208 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
209 }
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
210
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 static void
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 handle_suffix_line(cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 char *cp;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
215 char *np;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
216 uint16_t suffix;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
217 struct owned_number_rec own_rec;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
218 struct short_number_rec short_rec;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
220 if (!prefix_set) {
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
222 "number-db2 line %d: suffix not valid without preceding prefix\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 for (np = cp; *cp && !isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 if (*cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 *cp++ = '\0';
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 if (grok_number_string(np, 0) != 4) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
232 "number-db2 line %d: suffix requires 4-digit argument\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
236 suffix = digits4_to_uint16(np);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
237 bzero(&own_rec, sizeof own_rec);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
238 own_rec.number[0] = prefix_buf[0];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
239 own_rec.number[1] = prefix_buf[1];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
240 own_rec.number[2] = suffix;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
241 handle_number_attr(&own_rec, cp);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
242 enter_owned_number(&own_rec);
228
7ea6acdb8364 themwi-update-numdb2: logic fix in abbrev number creation
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
243 if (!prefix_allows_abbrev)
7ea6acdb8364 themwi-update-numdb2: logic fix in abbrev number creation
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
244 return;
7ea6acdb8364 themwi-update-numdb2: logic fix in abbrev number creation
Mychaela Falconia <falcon@freecalypso.org>
parents: 226
diff changeset
245 if ((own_rec.usage & NUMBER_USAGE_MASK) != NUMBER_USAGE_TYPE_GSM_SUB)
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 return;
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
247 bzero(&short_rec, sizeof short_rec);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
248 short_rec.short_num = suffix;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
249 short_rec.short_num_type = SHORT_NUM_TYPE_ABBREV;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
250 short_rec.fullnum_flags = own_rec.number_flags;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
251 short_rec.fullnum_prefix[0] = prefix_buf[0];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
252 short_rec.fullnum_prefix[1] = prefix_buf[1];
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
253 enter_short_number(&short_rec);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 static void
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 handle_full10_line(cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 char *cp;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 char *np, full10[11];
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
261 struct owned_number_rec own_rec;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
263 prefix_set = 0; /* cancel any previous prefix line */
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 for (np = cp; *cp && !isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 if (*cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 *cp++ = '\0';
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 if (grok_number_string(np, 1) != 10) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
270 "number-db2 line %d: full10 requires 10-digit argument\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 dehyphen_number_string(np, full10);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 if (!is_nanp_valid_prefix(full10)) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
277 "number-db2 line %d: number violates NANP rules\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
281 bzero(&own_rec, sizeof own_rec);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
282 own_rec.number[0] = digits3_to_uint16(full10);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
283 own_rec.number[1] = digits3_to_uint16(full10 + 3);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
284 own_rec.number[2] = digits4_to_uint16(full10 + 6);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
285 handle_number_attr(&own_rec, cp);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
286 enter_owned_number(&own_rec);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 static void
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 handle_itn_line(cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 char *cp;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 char *np;
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
294 struct short_number_rec short_rec;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
296 prefix_set = 0; /* cancel any previous prefix line */
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 for (np = cp; *cp && !isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 if (*cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 *cp++ = '\0';
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 if (grok_number_string(np, 0) != 4) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
303 "number-db2 line %d: itn requires 4-digit argument\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
307 bzero(&short_rec, sizeof short_rec);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
308 short_rec.short_num = digits4_to_uint16(np);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
309 short_rec.short_num_type = SHORT_NUM_TYPE_ITN;
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
310 enter_short_number(&short_rec);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 static void
229
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
314 handle_test_sink_line(cp)
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
315 char *cp;
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
316 {
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
317 char *np;
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
318 struct short_number_rec short_rec;
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
319
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
320 prefix_set = 0; /* cancel any previous prefix line */
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
321 for (np = cp; *cp && !isspace(*cp); cp++)
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
322 ;
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
323 if (*cp)
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
324 *cp++ = '\0';
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
325 if (grok_number_string(np, 0) != 4) {
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
326 fprintf(stderr,
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
327 "number-db2 line %d: test-sink requires 4-digit argument\n",
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
328 lineno);
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
329 exit(1);
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
330 }
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
331 bzero(&short_rec, sizeof short_rec);
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
332 short_rec.short_num = digits4_to_uint16(np);
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
333 short_rec.short_num_type = SHORT_NUM_TYPE_TEST_SINK;
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
334 enter_short_number(&short_rec);
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
335 }
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
336
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
337 static void
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 process_line()
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 char *cp, *np;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 void (*handler)();
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 if (!index(linebuf, '\n')) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
345 "number-db2 line %d: too long or missing newline\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 lineno);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 for (cp = linebuf; isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 if (*cp == '\0' || *cp == '#')
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 return;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 for (np = cp; *cp && !isspace(*cp); cp++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 ;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 if (*cp)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 *cp++ = '\0';
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 if (!strcmp(np, "prefix"))
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 handler = handle_prefix_line;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 else if (!strcmp(np, "suffix"))
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 handler = handle_suffix_line;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 else if (!strcmp(np, "full10"))
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 handler = handle_full10_line;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 else if (!strcmp(np, "itn"))
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 handler = handle_itn_line;
229
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
365 else if (!strcmp(np, "test-sink"))
626824449ddf themwi-update-numdb2: add test-sink support
Mychaela Falconia <falcon@freecalypso.org>
parents: 228
diff changeset
366 handler = handle_test_sink_line;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 else {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
369 "number-db2 line %d: non-understood keyword \"%s\"\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 lineno, np);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 while (isspace(*cp))
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 cp++;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 if (*cp == '\0' || *cp == '#') {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
377 "number-db2 line %d: missing argument after \"%s\" keyword\n",
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 lineno, np);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 handler(cp);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 static int
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 compare_owned_num(p1, p2)
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
386 uint16_t *p1, *p2;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 {
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
388 if (p1[0] < p2[0])
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
389 return(-1);
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
390 if (p1[0] > p2[0])
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
391 return(1);
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
392 if (p1[1] < p2[1])
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393 return(-1);
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
394 if (p1[1] > p2[1])
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395 return(1);
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
396 if (p1[2] < p2[2])
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
397 return(-1);
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
398 if (p1[2] > p2[2])
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
399 return(1);
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
400 return(0);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403 static int
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 compare_short_num(p1, p2)
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
405 uint16_t *p1, *p2;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 {
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
407 if (*p1 < *p2)
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408 return(-1);
230
803829e6244f themwi-update-numdb2: more sensible sort comparison functions
Mychaela Falconia <falcon@freecalypso.org>
parents: 229
diff changeset
409 if (*p1 > *p2)
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 return(1);
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
411 return(0);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 static void
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 owned_num_check_dup()
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416 {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
417 struct owned_number_rec *p, *endp;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419 endp = owned_number_buf + owned_number_count - 1;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 for (p = owned_number_buf; p < endp; p++) {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
421 if (p[0].number[0] == p[1].number[0] &&
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
422 p[0].number[1] == p[1].number[1] &&
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
423 p[0].number[2] == p[1].number[2]) {
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 fprintf(stderr,
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
425 "error: NANP number %03u-%03u-%04u appears more than once\n",
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
426 p[0].number[0], p[0].number[1], p[0].number[2]);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 static void
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433 short_num_check_dup()
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434 {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
435 struct short_number_rec *p, *endp;
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 endp = short_number_buf + short_number_count - 1;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438 for (p = short_number_buf; p < endp; p++) {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
439 if (p[0].short_num == p[1].short_num) {
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440 fprintf(stderr,
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 "error: short number %04u appears more than once\n",
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
442 (unsigned) p->short_num);
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448 static void
231
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
449 check_secondnum_mapto(src)
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
450 struct owned_number_rec *src;
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
451 {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
452 struct owned_number_rec *dest;
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
453
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
454 dest = bsearch(src->remap, owned_number_buf, owned_number_count,
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
455 sizeof(struct owned_number_rec), compare_owned_num);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
456 if (!dest) {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
457 fprintf(stderr,
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
458 "error: NANP %03u-%03u-%04u map-to target is not in the database\n",
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
459 src->number[0], src->number[1], src->number[2]);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
460 exit(1);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
461 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
462 if ((dest->usage & NUMBER_USAGE_MASK) != NUMBER_USAGE_TYPE_GSM_SUB) {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
463 fprintf(stderr,
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
464 "error: NANP %03u-%03u-%04u map-to target is not a gsm-sub number\n",
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
465 src->number[0], src->number[1], src->number[2]);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
466 exit(1);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
467 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
468 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
469
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
470 static void
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
471 check_secondnum_e911via(src)
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
472 struct owned_number_rec *src;
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
473 {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
474 struct owned_number_rec *dest;
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
475
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
476 dest = bsearch(src->remap, owned_number_buf, owned_number_count,
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
477 sizeof(struct owned_number_rec), compare_owned_num);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
478 if (!dest) {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
479 fprintf(stderr,
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
480 "error: NANP %03u-%03u-%04u e911-via target is not in the database\n",
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
481 src->number[0], src->number[1], src->number[2]);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
482 exit(1);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
483 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
484 if (!(dest->number_flags & NUMBER_FLAG_E911PROV)) {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
485 fprintf(stderr,
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
486 "error: NANP %03u-%03u-%04u e911-via target is not an E911 number\n",
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
487 src->number[0], src->number[1], src->number[2]);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
488 exit(1);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
489 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
490 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
491
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
492 static void
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
493 check_secondary_numbers()
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
494 {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
495 struct owned_number_rec *p, *endp;
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
496
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
497 endp = owned_number_buf + owned_number_count;
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
498 for (p = owned_number_buf; p < endp; p++) {
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
499 if ((p->usage & NUMBER_USAGE_MASK) == NUMBER_USAGE_TYPE_ALIAS)
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
500 check_secondnum_mapto(p);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
501 if (p->usage & NUMBER_USAGE_FLAG_E911_VIA)
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
502 check_secondnum_e911via(p);
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
503 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
504 }
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
505
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
506 static void
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 emit_output()
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 FILE *outf;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510 struct numdb_file_hdr hdr;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
512 outf = fopen("number-db2.newbin", "w");
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 if (!outf) {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
514 perror("creating number-db2.newbin");
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 hdr.owned_number_count = owned_number_count;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 hdr.short_number_count = short_number_count;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 if (fwrite(&hdr, sizeof hdr, 1, outf) != 1) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520 write_err: fprintf(stderr, "error writing to new binary file\n");
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523 if (fwrite(owned_number_buf, sizeof(owned_number_buf[0]),
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 owned_number_count, outf) != owned_number_count)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525 goto write_err;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526 if (fwrite(short_number_buf, sizeof(short_number_buf[0]),
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 short_number_count, outf) != short_number_count)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528 goto write_err;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529 fclose(outf);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 main(argc, argv)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 char **argv;
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534 {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 if (argc > 2) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536 fprintf(stderr, "usage: %s [directory]\n", argv[0]);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 if (argv[1])
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540 system_dir = argv[1];
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541 else
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 system_dir = "/var/gsm";
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 if (chdir(system_dir) < 0) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 perror(system_dir);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546 }
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
547 inf = fopen("number-db2", "r");
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548 if (!inf) {
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
549 perror("opening number-db2");
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552 for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++)
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553 process_line();
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 fclose(inf);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555 if (owned_number_count >= 2) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 qsort(owned_number_buf, owned_number_count,
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 sizeof(owned_number_buf[0]), compare_owned_num);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 owned_num_check_dup();
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559 }
231
abb3f415b9dd themwi-update-numdb2: check secondary numbers
Mychaela Falconia <falcon@freecalypso.org>
parents: 230
diff changeset
560 check_secondary_numbers();
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 if (short_number_count >= 2) {
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562 qsort(short_number_buf, short_number_count,
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 sizeof(short_number_buf[0]), compare_short_num);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564 short_num_check_dup();
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 emit_output();
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 /* make it live */
226
28441920fb35 beginning of number database version 2
Mychaela Falconia <falcon@freecalypso.org>
parents: 4
diff changeset
568 if (rename("number-db2.newbin", "number-db2.bin") < 0) {
4
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 perror("rename");
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570 exit(1);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 }
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 exit(0);
4ad5deafaa87 themwi-update-numdb utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573 }