ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/cv.c
Revision: 1.3
Committed: Sat Nov 15 02:13:36 2003 UTC (20 years, 11 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R7P2, rad3R7P1, rad3R6, rad3R6P1, rad3R8
Changes since 1.2: +6 -6 lines
Log Message:
Continued ANSIfication, and reduced other compile warnings.

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 schorsch 1.3 static const char RCSid[] = "$Id: cv.c,v 1.2 2003/08/01 14:14:24 schorsch Exp $";
3 greg 1.1 #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    
14     char *progname;
15    
16    
17 schorsch 1.3 int
18     main(
19     int argc,
20     char **argv
21     )
22 greg 1.1
23     {
24     FILE *fp;
25     PRIMITIVE curp;
26     short htom = TRUE;
27    
28     progname = *argv++;
29     argc--;
30    
31     if (argc && **argv == '-') {
32     htom = FALSE;
33     argv++;
34     argc--;
35     }
36    
37     if (argc)
38     for (; argc; argc--, argv++) {
39     fp = efopen(*argv, "r");
40     if (htom)
41     while (scanp(&curp, fp)) {
42     writep(&curp, stdout);
43     fargs(&curp);
44     }
45     else
46     while (readp(&curp, fp)) {
47     printp(&curp, stdout);
48     fargs(&curp);
49     }
50     fclose(fp);
51     }
52     else
53     if (htom)
54     while (scanp(&curp, stdin)) {
55     writep(&curp, stdout);
56     fargs(&curp);
57     }
58     else
59     while (readp(&curp, stdin)) {
60     printp(&curp, stdout);
61     fargs(&curp);
62     }
63    
64     if (htom)
65     writeof(stdout);
66    
67     return(0);
68     }