1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM *
4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM *
8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM * and limitations under the License.
12*7836SJohn.Forte@Sun.COM *
13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM *
19*7836SJohn.Forte@Sun.COM * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23*7836SJohn.Forte@Sun.COM * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM */
25*7836SJohn.Forte@Sun.COM
26*7836SJohn.Forte@Sun.COM /*
27*7836SJohn.Forte@Sun.COM * Read an errgen status resource file (*.err) from standard input and
28*7836SJohn.Forte@Sun.COM * write an SPCS error code C header file (-c), Java resource file (-j),
29*7836SJohn.Forte@Sun.COM * libspcs Java exception class file(-e), error text file (-m) or JNI
30*7836SJohn.Forte@Sun.COM * exception trinket table to standard output. Lines starting with "#"
31*7836SJohn.Forte@Sun.COM * are ignored.
32*7836SJohn.Forte@Sun.COM *
33*7836SJohn.Forte@Sun.COM * Use "errgen -h" to get usage info including module codes and example
34*7836SJohn.Forte@Sun.COM * input and output.
35*7836SJohn.Forte@Sun.COM */
36*7836SJohn.Forte@Sun.COM
37*7836SJohn.Forte@Sun.COM
38*7836SJohn.Forte@Sun.COM #include <stdio.h>
39*7836SJohn.Forte@Sun.COM #include <stdlib.h>
40*7836SJohn.Forte@Sun.COM #include <string.h>
41*7836SJohn.Forte@Sun.COM #include <ctype.h>
42*7836SJohn.Forte@Sun.COM #include <libgen.h>
43*7836SJohn.Forte@Sun.COM #include <limits.h>
44*7836SJohn.Forte@Sun.COM #include <sys/param.h>
45*7836SJohn.Forte@Sun.COM
46*7836SJohn.Forte@Sun.COM /* The public error info header file. */
47*7836SJohn.Forte@Sun.COM
48*7836SJohn.Forte@Sun.COM #include <sys/unistat/spcs_s.h>
49*7836SJohn.Forte@Sun.COM
50*7836SJohn.Forte@Sun.COM /* The private error info header file */
51*7836SJohn.Forte@Sun.COM
52*7836SJohn.Forte@Sun.COM #include <sys/unistat/spcs_s_impl.h>
53*7836SJohn.Forte@Sun.COM
54*7836SJohn.Forte@Sun.COM
55*7836SJohn.Forte@Sun.COM /* locals */
56*7836SJohn.Forte@Sun.COM
57*7836SJohn.Forte@Sun.COM static enum {C_MODE, J_MODE, M_MODE, E_MODE, T_MODE, X_MODE} mode = E_MODE;
58*7836SJohn.Forte@Sun.COM static char key[SPCS_S_MAXKEY];
59*7836SJohn.Forte@Sun.COM static char text[SPCS_S_MAXTEXT];
60*7836SJohn.Forte@Sun.COM static int mod_number;
61*7836SJohn.Forte@Sun.COM
62*7836SJohn.Forte@Sun.COM static char help_path[PATH_MAX];
63*7836SJohn.Forte@Sun.COM
64*7836SJohn.Forte@Sun.COM static int count = 1;
65*7836SJohn.Forte@Sun.COM
66*7836SJohn.Forte@Sun.COM static char key[SPCS_S_MAXKEY];
67*7836SJohn.Forte@Sun.COM static char text[SPCS_S_MAXTEXT];
68*7836SJohn.Forte@Sun.COM static char modname[SPCS_S_MAXMODNAME];
69*7836SJohn.Forte@Sun.COM
70*7836SJohn.Forte@Sun.COM /*
71*7836SJohn.Forte@Sun.COM * Display help info
72*7836SJohn.Forte@Sun.COM */
73*7836SJohn.Forte@Sun.COM
74*7836SJohn.Forte@Sun.COM static void
help()75*7836SJohn.Forte@Sun.COM help()
76*7836SJohn.Forte@Sun.COM {
77*7836SJohn.Forte@Sun.COM char line[SPCS_S_MAXLINE];
78*7836SJohn.Forte@Sun.COM FILE *h = fopen(help_path, "r");
79*7836SJohn.Forte@Sun.COM
80*7836SJohn.Forte@Sun.COM if (h) {
81*7836SJohn.Forte@Sun.COM while (! feof(h)) {
82*7836SJohn.Forte@Sun.COM (void) fgets(line, SPCS_S_MAXLINE, h);
83*7836SJohn.Forte@Sun.COM if (! feof(h))
84*7836SJohn.Forte@Sun.COM (void) fputs(line, stderr);
85*7836SJohn.Forte@Sun.COM }
86*7836SJohn.Forte@Sun.COM } else {
87*7836SJohn.Forte@Sun.COM perror(strcat("could not open: ", help_path));
88*7836SJohn.Forte@Sun.COM exit(1);
89*7836SJohn.Forte@Sun.COM }
90*7836SJohn.Forte@Sun.COM }
91*7836SJohn.Forte@Sun.COM
92*7836SJohn.Forte@Sun.COM /*
93*7836SJohn.Forte@Sun.COM * Put out a message with terse instructions and err out
94*7836SJohn.Forte@Sun.COM */
95*7836SJohn.Forte@Sun.COM
96*7836SJohn.Forte@Sun.COM static void
fatal(char * msg)97*7836SJohn.Forte@Sun.COM fatal(char *msg)
98*7836SJohn.Forte@Sun.COM {
99*7836SJohn.Forte@Sun.COM (void) fprintf(stderr, "%s\n\n", msg);
100*7836SJohn.Forte@Sun.COM (void) fprintf(stderr, "use errgen -h for help\n");
101*7836SJohn.Forte@Sun.COM exit(1);
102*7836SJohn.Forte@Sun.COM }
103*7836SJohn.Forte@Sun.COM
104*7836SJohn.Forte@Sun.COM /*
105*7836SJohn.Forte@Sun.COM * Put out the output file preamble
106*7836SJohn.Forte@Sun.COM */
107*7836SJohn.Forte@Sun.COM
108*7836SJohn.Forte@Sun.COM static void
do_preamble()109*7836SJohn.Forte@Sun.COM do_preamble()
110*7836SJohn.Forte@Sun.COM {
111*7836SJohn.Forte@Sun.COM switch (mode) {
112*7836SJohn.Forte@Sun.COM case M_MODE:
113*7836SJohn.Forte@Sun.COM (void) fprintf(stdout,
114*7836SJohn.Forte@Sun.COM "static\nchar *SPCS_MSG_%s[] = {\n", modname);
115*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "\t\"\",\n");
116*7836SJohn.Forte@Sun.COM break;
117*7836SJohn.Forte@Sun.COM case T_MODE:
118*7836SJohn.Forte@Sun.COM (void) fprintf(stdout,
119*7836SJohn.Forte@Sun.COM "static\nchar *SPCS_TRNK_%s[] = {\n", modname);
120*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "\t\"\",\n");
121*7836SJohn.Forte@Sun.COM break;
122*7836SJohn.Forte@Sun.COM }
123*7836SJohn.Forte@Sun.COM }
124*7836SJohn.Forte@Sun.COM
125*7836SJohn.Forte@Sun.COM /*
126*7836SJohn.Forte@Sun.COM * Put out the output file trailer
127*7836SJohn.Forte@Sun.COM */
128*7836SJohn.Forte@Sun.COM
129*7836SJohn.Forte@Sun.COM static void
do_trailer()130*7836SJohn.Forte@Sun.COM do_trailer()
131*7836SJohn.Forte@Sun.COM {
132*7836SJohn.Forte@Sun.COM switch (mode) {
133*7836SJohn.Forte@Sun.COM case M_MODE:
134*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "};\n");
135*7836SJohn.Forte@Sun.COM (void) fprintf(stdout,
136*7836SJohn.Forte@Sun.COM "#define\tSPCS_MSGLEN_%s %d\t/* total codes */\n",
137*7836SJohn.Forte@Sun.COM modname, count-1);
138*7836SJohn.Forte@Sun.COM break;
139*7836SJohn.Forte@Sun.COM case T_MODE:
140*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "};\n");
141*7836SJohn.Forte@Sun.COM (void) fprintf(stdout,
142*7836SJohn.Forte@Sun.COM "#define\tSPCS_TRNKLEN_%s %d\t/* total codes */\n",
143*7836SJohn.Forte@Sun.COM modname, count-1);
144*7836SJohn.Forte@Sun.COM break;
145*7836SJohn.Forte@Sun.COM }
146*7836SJohn.Forte@Sun.COM }
147*7836SJohn.Forte@Sun.COM
148*7836SJohn.Forte@Sun.COM /*
149*7836SJohn.Forte@Sun.COM * Process a single input line
150*7836SJohn.Forte@Sun.COM */
151*7836SJohn.Forte@Sun.COM
152*7836SJohn.Forte@Sun.COM static void
do_line()153*7836SJohn.Forte@Sun.COM do_line()
154*7836SJohn.Forte@Sun.COM {
155*7836SJohn.Forte@Sun.COM spcs_s_udata_t c;
156*7836SJohn.Forte@Sun.COM int fc = 0;
157*7836SJohn.Forte@Sun.COM int len = 0;
158*7836SJohn.Forte@Sun.COM char ptext[SPCS_S_MAXTEXT];
159*7836SJohn.Forte@Sun.COM char keystring[SPCS_S_MAXKEY+SPCS_S_MAXPRE];
160*7836SJohn.Forte@Sun.COM char *p = text;
161*7836SJohn.Forte@Sun.COM int tlen;
162*7836SJohn.Forte@Sun.COM char *pt = ptext;
163*7836SJohn.Forte@Sun.COM char havebytestream = 0;
164*7836SJohn.Forte@Sun.COM
165*7836SJohn.Forte@Sun.COM c.i = 0;
166*7836SJohn.Forte@Sun.COM (void) sprintf(keystring, "%s_E%s", modname, key);
167*7836SJohn.Forte@Sun.COM while (*p) {
168*7836SJohn.Forte@Sun.COM if (*p == '%') {
169*7836SJohn.Forte@Sun.COM if (*(p + 1) != 's') {
170*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
171*7836SJohn.Forte@Sun.COM "ERRGEN: Error in .err file\n");
172*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
173*7836SJohn.Forte@Sun.COM "%c is an illegal format spec after %%",
174*7836SJohn.Forte@Sun.COM *p);
175*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
176*7836SJohn.Forte@Sun.COM " at line: %d pos: %d\n", count,
177*7836SJohn.Forte@Sun.COM /* LINTED possible ptrdiff_t overflow */
178*7836SJohn.Forte@Sun.COM (int)(p - text));
179*7836SJohn.Forte@Sun.COM fatal("");
180*7836SJohn.Forte@Sun.COM }
181*7836SJohn.Forte@Sun.COM len = sprintf(pt, "{%d}", fc);
182*7836SJohn.Forte@Sun.COM pt += len;
183*7836SJohn.Forte@Sun.COM p++;
184*7836SJohn.Forte@Sun.COM fc += 1;
185*7836SJohn.Forte@Sun.COM if (fc > SPCS_S_MAXSUPP) {
186*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
187*7836SJohn.Forte@Sun.COM "ERRGEN: Error in .err file\n");
188*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
189*7836SJohn.Forte@Sun.COM "SPCS_S_MAXSUPP exceeeded\n");
190*7836SJohn.Forte@Sun.COM fatal("Too many %%s specifiers");
191*7836SJohn.Forte@Sun.COM }
192*7836SJohn.Forte@Sun.COM } else
193*7836SJohn.Forte@Sun.COM *pt++ = *p;
194*7836SJohn.Forte@Sun.COM p++;
195*7836SJohn.Forte@Sun.COM }
196*7836SJohn.Forte@Sun.COM
197*7836SJohn.Forte@Sun.COM /* look for a bytestream indicator */
198*7836SJohn.Forte@Sun.COM
199*7836SJohn.Forte@Sun.COM tlen = strlen(text);
200*7836SJohn.Forte@Sun.COM
201*7836SJohn.Forte@Sun.COM if ((tlen > 2) && (text[tlen - 1] == '@') && (text[tlen - 2] == '@')) {
202*7836SJohn.Forte@Sun.COM if (fc)
203*7836SJohn.Forte@Sun.COM fatal("ERRGEN: cannot have %%s and @@ ending too");
204*7836SJohn.Forte@Sun.COM
205*7836SJohn.Forte@Sun.COM /* bump the item count and set the bytestream flag */
206*7836SJohn.Forte@Sun.COM fc += 1;
207*7836SJohn.Forte@Sun.COM havebytestream = 1;
208*7836SJohn.Forte@Sun.COM }
209*7836SJohn.Forte@Sun.COM
210*7836SJohn.Forte@Sun.COM *pt = 0;
211*7836SJohn.Forte@Sun.COM
212*7836SJohn.Forte@Sun.COM switch (mode) {
213*7836SJohn.Forte@Sun.COM case C_MODE:
214*7836SJohn.Forte@Sun.COM c.f.bytestream = havebytestream;
215*7836SJohn.Forte@Sun.COM c.f.sup_count = fc;
216*7836SJohn.Forte@Sun.COM c.f.module = mod_number;
217*7836SJohn.Forte@Sun.COM c.f.code = count;
218*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "#define\t%s 0x%x /* %s */\n",
219*7836SJohn.Forte@Sun.COM keystring, c.i, text);
220*7836SJohn.Forte@Sun.COM break;
221*7836SJohn.Forte@Sun.COM case J_MODE:
222*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "`%s` = %s\n", keystring, ptext);
223*7836SJohn.Forte@Sun.COM break;
224*7836SJohn.Forte@Sun.COM case X_MODE:
225*7836SJohn.Forte@Sun.COM (void) fprintf(stdout,
226*7836SJohn.Forte@Sun.COM "#define\tT_%s \"`%s`\"\n", keystring, keystring);
227*7836SJohn.Forte@Sun.COM break;
228*7836SJohn.Forte@Sun.COM case T_MODE:
229*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "\t\"`%s`\",\n", keystring);
230*7836SJohn.Forte@Sun.COM break;
231*7836SJohn.Forte@Sun.COM case M_MODE:
232*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, "\t\"%s\",\n", text);
233*7836SJohn.Forte@Sun.COM break;
234*7836SJohn.Forte@Sun.COM case E_MODE:
235*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, " /**\n * %s\n **/\n",
236*7836SJohn.Forte@Sun.COM text);
237*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, " public static final String %s",
238*7836SJohn.Forte@Sun.COM keystring);
239*7836SJohn.Forte@Sun.COM (void) fprintf(stdout, " = `%s`;\n\n", keystring);
240*7836SJohn.Forte@Sun.COM break;
241*7836SJohn.Forte@Sun.COM }
242*7836SJohn.Forte@Sun.COM }
243*7836SJohn.Forte@Sun.COM
244*7836SJohn.Forte@Sun.COM int
main(int argc,char ** argv)245*7836SJohn.Forte@Sun.COM main(int argc, char **argv)
246*7836SJohn.Forte@Sun.COM {
247*7836SJohn.Forte@Sun.COM int i;
248*7836SJohn.Forte@Sun.COM int searching = 1;
249*7836SJohn.Forte@Sun.COM char searchname[SPCS_S_MAXMODNAME];
250*7836SJohn.Forte@Sun.COM char line[SPCS_S_MAXLINE];
251*7836SJohn.Forte@Sun.COM char tline[SPCS_S_MAXLINE];
252*7836SJohn.Forte@Sun.COM char *p, *p2;
253*7836SJohn.Forte@Sun.COM
254*7836SJohn.Forte@Sun.COM (void) strcpy(help_path, dirname(argv[0]));
255*7836SJohn.Forte@Sun.COM (void) strcat(help_path, "/errgen.help");
256*7836SJohn.Forte@Sun.COM if ((argc == 1) || ((argc == 2) && (strcmp(argv[1], "-h") == 0))) {
257*7836SJohn.Forte@Sun.COM help();
258*7836SJohn.Forte@Sun.COM exit(0);
259*7836SJohn.Forte@Sun.COM }
260*7836SJohn.Forte@Sun.COM
261*7836SJohn.Forte@Sun.COM if (argc != 3)
262*7836SJohn.Forte@Sun.COM fatal("Bad number of arguments");
263*7836SJohn.Forte@Sun.COM
264*7836SJohn.Forte@Sun.COM p = argv[2];
265*7836SJohn.Forte@Sun.COM p2 = modname;
266*7836SJohn.Forte@Sun.COM
267*7836SJohn.Forte@Sun.COM while (*p)
268*7836SJohn.Forte@Sun.COM *p2++ = toupper(*p++);
269*7836SJohn.Forte@Sun.COM *p2 = 0;
270*7836SJohn.Forte@Sun.COM
271*7836SJohn.Forte@Sun.COM switch (argv[1][1]) {
272*7836SJohn.Forte@Sun.COM case 'c':
273*7836SJohn.Forte@Sun.COM mode = C_MODE;
274*7836SJohn.Forte@Sun.COM break;
275*7836SJohn.Forte@Sun.COM case 'j':
276*7836SJohn.Forte@Sun.COM mode = J_MODE;
277*7836SJohn.Forte@Sun.COM break;
278*7836SJohn.Forte@Sun.COM case 'e':
279*7836SJohn.Forte@Sun.COM mode = E_MODE;
280*7836SJohn.Forte@Sun.COM break;
281*7836SJohn.Forte@Sun.COM case 'm':
282*7836SJohn.Forte@Sun.COM mode = M_MODE;
283*7836SJohn.Forte@Sun.COM break;
284*7836SJohn.Forte@Sun.COM case 't':
285*7836SJohn.Forte@Sun.COM mode = T_MODE;
286*7836SJohn.Forte@Sun.COM break;
287*7836SJohn.Forte@Sun.COM case 'x':
288*7836SJohn.Forte@Sun.COM mode = X_MODE;
289*7836SJohn.Forte@Sun.COM break;
290*7836SJohn.Forte@Sun.COM default:
291*7836SJohn.Forte@Sun.COM fatal("Unknown option switch");
292*7836SJohn.Forte@Sun.COM }
293*7836SJohn.Forte@Sun.COM
294*7836SJohn.Forte@Sun.COM if (strcmp(modname, "DSW") == 0) {
295*7836SJohn.Forte@Sun.COM (void) strcpy(searchname, "II");
296*7836SJohn.Forte@Sun.COM } else if (strcmp(modname, "RDC") == 0) {
297*7836SJohn.Forte@Sun.COM (void) strcpy(searchname, "SNDR");
298*7836SJohn.Forte@Sun.COM } else if (strcmp(modname, "SDCTL") == 0) {
299*7836SJohn.Forte@Sun.COM (void) strcpy(searchname, "NSCTL");
300*7836SJohn.Forte@Sun.COM } else {
301*7836SJohn.Forte@Sun.COM (void) strcpy(searchname, modname);
302*7836SJohn.Forte@Sun.COM }
303*7836SJohn.Forte@Sun.COM
304*7836SJohn.Forte@Sun.COM i = 0;
305*7836SJohn.Forte@Sun.COM do {
306*7836SJohn.Forte@Sun.COM if (strcmp(module_names[i++], searchname) == 0) {
307*7836SJohn.Forte@Sun.COM searching = 0;
308*7836SJohn.Forte@Sun.COM mod_number = i - 1;
309*7836SJohn.Forte@Sun.COM break;
310*7836SJohn.Forte@Sun.COM }
311*7836SJohn.Forte@Sun.COM } while (module_names[i]);
312*7836SJohn.Forte@Sun.COM
313*7836SJohn.Forte@Sun.COM if (searching) {
314*7836SJohn.Forte@Sun.COM if (i != SPCS_M_MAX)
315*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
316*7836SJohn.Forte@Sun.COM "NULL in module_names before SPCS_M_MAX\n");
317*7836SJohn.Forte@Sun.COM fatal("Undefined module name");
318*7836SJohn.Forte@Sun.COM }
319*7836SJohn.Forte@Sun.COM
320*7836SJohn.Forte@Sun.COM do_preamble();
321*7836SJohn.Forte@Sun.COM
322*7836SJohn.Forte@Sun.COM while (!feof(stdin)) {
323*7836SJohn.Forte@Sun.COM (void) fgets(line, SPCS_S_MAXLINE, stdin);
324*7836SJohn.Forte@Sun.COM if (feof(stdin)) {
325*7836SJohn.Forte@Sun.COM if (count == 0)
326*7836SJohn.Forte@Sun.COM fatal("errgen file empty");
327*7836SJohn.Forte@Sun.COM
328*7836SJohn.Forte@Sun.COM do_trailer();
329*7836SJohn.Forte@Sun.COM exit(0);
330*7836SJohn.Forte@Sun.COM }
331*7836SJohn.Forte@Sun.COM line[strlen(line)-1] = 0;
332*7836SJohn.Forte@Sun.COM if ((strlen(line) != 0) && (line[0] != '#')) {
333*7836SJohn.Forte@Sun.COM (void) strcpy(tline, line);
334*7836SJohn.Forte@Sun.COM p = strchr(tline, ' ');
335*7836SJohn.Forte@Sun.COM if (p == NULL) {
336*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
337*7836SJohn.Forte@Sun.COM "blank separator missing at line: %d\n",
338*7836SJohn.Forte@Sun.COM count);
339*7836SJohn.Forte@Sun.COM fatal("");
340*7836SJohn.Forte@Sun.COM }
341*7836SJohn.Forte@Sun.COM *p = 0;
342*7836SJohn.Forte@Sun.COM if (strlen(p) > SPCS_S_MAXKEY) {
343*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
344*7836SJohn.Forte@Sun.COM "message label too long at line: %d\n", count);
345*7836SJohn.Forte@Sun.COM fatal("");
346*7836SJohn.Forte@Sun.COM }
347*7836SJohn.Forte@Sun.COM (void) strcpy(key, tline);
348*7836SJohn.Forte@Sun.COM if (strlen(key) == 0) {
349*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
350*7836SJohn.Forte@Sun.COM "leading blank at line: %d\n", count);
351*7836SJohn.Forte@Sun.COM fatal("");
352*7836SJohn.Forte@Sun.COM }
353*7836SJohn.Forte@Sun.COM p++;
354*7836SJohn.Forte@Sun.COM if (*p != '=') {
355*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
356*7836SJohn.Forte@Sun.COM "= separator missing at line: %d\n", count);
357*7836SJohn.Forte@Sun.COM fatal("");
358*7836SJohn.Forte@Sun.COM }
359*7836SJohn.Forte@Sun.COM p++;
360*7836SJohn.Forte@Sun.COM if (*p != ' ') {
361*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
362*7836SJohn.Forte@Sun.COM "blank separator missing at line: %d\n", count);
363*7836SJohn.Forte@Sun.COM fatal("");
364*7836SJohn.Forte@Sun.COM }
365*7836SJohn.Forte@Sun.COM p++;
366*7836SJohn.Forte@Sun.COM if (! *p) {
367*7836SJohn.Forte@Sun.COM (void) fprintf(stderr,
368*7836SJohn.Forte@Sun.COM "msg text missing at line:%d\n", count);
369*7836SJohn.Forte@Sun.COM fatal("");
370*7836SJohn.Forte@Sun.COM }
371*7836SJohn.Forte@Sun.COM (void) strcpy(text, p);
372*7836SJohn.Forte@Sun.COM
373*7836SJohn.Forte@Sun.COM do_line();
374*7836SJohn.Forte@Sun.COM count++;
375*7836SJohn.Forte@Sun.COM }
376*7836SJohn.Forte@Sun.COM }
377*7836SJohn.Forte@Sun.COM
378*7836SJohn.Forte@Sun.COM return (0);
379*7836SJohn.Forte@Sun.COM }
380