Remove building with NOCRYPTO option
[minix.git] / external / bsd / nvi / dist / catalog / dump.c
blob40d369a5f67ac8ae8cfea768d598d48ffb3b3dce
1 /* $NetBSD: dump.c,v 1.4 2014/01/28 20:43:55 joerg 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 #if defined(__NetBSD__)
10 #include <sys/cdefs.h>
11 #if 0
12 #ifndef lint
13 static char copyright[] =
14 "%Z% Copyright (c) 1992, 1993, 1994\n\
15 The Regents of the University of California. All rights reserved.\n";
16 #endif /* not lint */
17 #else
18 __RCSID("$NetBSD: dump.c,v 1.4 2014/01/28 20:43:55 joerg Exp $");
19 #endif
20 #endif
22 #include <ctype.h>
23 #include <stdio.h>
24 #include <stdlib.h>
26 static void
27 parse(fp)
28 FILE *fp;
30 int ch, s1, s2, s3;
32 #define TESTD(s) { \
33 if ((s = getc(fp)) == EOF) \
34 return; \
35 if (!isdigit(s)) \
36 continue; \
38 #define TESTP { \
39 if ((ch = getc(fp)) == EOF) \
40 return; \
41 if (ch != '|') \
42 continue; \
44 #define MOVEC(t) { \
45 do { \
46 if ((ch = getc(fp)) == EOF) \
47 return; \
48 } while (ch != (t)); \
50 for (;;) {
51 MOVEC('"');
52 TESTD(s1);
53 TESTD(s2);
54 TESTD(s3);
55 TESTP;
56 putchar('"');
57 putchar(s1);
58 putchar(s2);
59 putchar(s3);
60 putchar('|');
61 for (;;) { /* dump to end quote. */
62 if ((ch = getc(fp)) == EOF)
63 return;
64 putchar(ch);
65 if (ch == '"')
66 break;
67 if (ch == '\\') {
68 if ((ch = getc(fp)) == EOF)
69 return;
70 putchar(ch);
73 putchar('\n');
77 int
78 main(argc, argv)
79 int argc;
80 char *argv[];
82 FILE *fp;
84 for (; *argv != NULL; ++argv) {
85 if ((fp = fopen(*argv, "r")) == NULL) {
86 perror(*argv);
87 exit (1);
89 parse(fp);
90 (void)fclose(fp);
92 exit (0);