ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/cv.c
Revision: 1.2
Committed: Fri Aug 1 14:14:24 2003 UTC (20 years, 8 months ago) by schorsch
Content type: text/plain
Branch: MAIN
Changes since 1.1: +1 -5 lines
Log Message:
Eliminated CPM, MAC, and UNIX conditional compiles.

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 schorsch 1.2 static const char RCSid[] = "$Id: cv.c,v 1.1 2003/02/22 02:07:26 greg 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    
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     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     }