ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/cv.c
Revision: 1.4
Committed: Wed Nov 21 18:51:05 2007 UTC (16 years, 4 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R1, rad4R0, rad3R9, rad4R2P1, rad5R3, HEAD
Changes since 1.3: +4 -1 lines
Log Message:
Fixed implicit declarations

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: cv.c,v 1.3 2003/11/15 02:13:36 schorsch Exp $";
3 #endif
4 /*
5 * Human-readable file I/O conversion program
6 *
7 * cc -o ../cv cv.c mfio.o cvhfio.o syscalls.o misc.o
8 */
9
10
11 #include "meta.h"
12
13 extern int scanp(PRIMITIVE *p, FILE *fp);
14 extern void printp(PRIMITIVE *p, FILE *fp);
15 extern void printeof(FILE *fp);
16
17 char *progname;
18
19
20 int
21 main(
22 int argc,
23 char **argv
24 )
25
26 {
27 FILE *fp;
28 PRIMITIVE curp;
29 short htom = TRUE;
30
31 progname = *argv++;
32 argc--;
33
34 if (argc && **argv == '-') {
35 htom = FALSE;
36 argv++;
37 argc--;
38 }
39
40 if (argc)
41 for (; argc; argc--, argv++) {
42 fp = efopen(*argv, "r");
43 if (htom)
44 while (scanp(&curp, fp)) {
45 writep(&curp, stdout);
46 fargs(&curp);
47 }
48 else
49 while (readp(&curp, fp)) {
50 printp(&curp, stdout);
51 fargs(&curp);
52 }
53 fclose(fp);
54 }
55 else
56 if (htom)
57 while (scanp(&curp, stdin)) {
58 writep(&curp, stdout);
59 fargs(&curp);
60 }
61 else
62 while (readp(&curp, stdin)) {
63 printp(&curp, stdout);
64 fargs(&curp);
65 }
66
67 if (htom)
68 writeof(stdout);
69
70 return(0);
71 }