ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/cv.c
Revision: 1.1
Committed: Sat Feb 22 02:07:26 2003 UTC (21 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

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