tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / nvi / dist / catalog / dump.c
blobb11b97842467815f8007fc9fa46297e119093487
1 /* $NetBSD: dump.c,v 1.2 2013/11/22 15:52:04 christos Exp $ */
2 /*-
3 * Copyright (c) 1992, 1993, 1994
4 * The Regents of the University of California. All rights reserved.
6 * %sccs.include.redist.c%
7 */
9 #ifndef lint
10 static char copyright[] =
11 "%Z% Copyright (c) 1992, 1993, 1994\n\
12 The Regents of the University of California. All rights reserved.\n";
13 #endif /* not lint */
15 #ifndef lint
16 static char sccsid[] = "Id: dump.c,v 8.1 1994/08/31 13:27:37 bostic Exp (Berkeley) Date: 1994/08/31 13:27:37 ";
17 #endif /* not lint */
19 #include <ctype.h>
20 #include <stdio.h>
21 #include <stdlib.h>
23 static void
24 parse(fp)
25 FILE *fp;
27 int ch, s1, s2, s3;
29 #define TESTD(s) { \
30 if ((s = getc(fp)) == EOF) \
31 return; \
32 if (!isdigit(s)) \
33 continue; \
35 #define TESTP { \
36 if ((ch = getc(fp)) == EOF) \
37 return; \
38 if (ch != '|') \
39 continue; \
41 #define MOVEC(t) { \
42 do { \
43 if ((ch = getc(fp)) == EOF) \
44 return; \
45 } while (ch != (t)); \
47 for (;;) {
48 MOVEC('"');
49 TESTD(s1);
50 TESTD(s2);
51 TESTD(s3);
52 TESTP;
53 putchar('"');
54 putchar(s1);
55 putchar(s2);
56 putchar(s3);
57 putchar('|');
58 for (;;) { /* dump to end quote. */
59 if ((ch = getc(fp)) == EOF)
60 return;
61 putchar(ch);
62 if (ch == '"')
63 break;
64 if (ch == '\\') {
65 if ((ch = getc(fp)) == EOF)
66 return;
67 putchar(ch);
70 putchar('\n');
74 int
75 main(argc, argv)
76 int argc;
77 char *argv[];
79 FILE *fp;
81 for (; *argv != NULL; ++argv) {
82 if ((fp = fopen(*argv, "r")) == NULL) {
83 perror(*argv);
84 exit (1);
86 parse(fp);
87 (void)fclose(fp);
89 exit (0);