ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/pexpand.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: pexpand.c,v 1.1 2003/02/22 02:07:26 greg Exp $";
3 greg 1.1 #endif
4     /*
5     * Program to expand meta-file commands
6     *
7     * cc pexpand.c expand.o mfio.o segment.o palloc.o syscalls.o misc.o
8     */
9    
10    
11     #include "meta.h"
12    
13    
14    
15     char *progname;
16    
17     int maxalloc = 0; /* no limit */
18    
19    
20    
21     main(argc, argv)
22    
23     int argc;
24     char **argv;
25    
26     {
27     FILE *fp;
28     int i;
29     char *cp;
30     int com;
31     short exlist[NCOMMANDS]; /* 1==expand, 0==pass, -1==discard */
32    
33     progname = *argv++;
34     argc--;
35    
36     for (i = 0; i < NCOMMANDS; i++)
37     exlist[i] = 0;
38    
39     while (argc && (**argv == '+' || **argv == '-')) {
40     i = (**argv == '+') ? 1 : -1;
41     for (cp = *argv+1; *cp ; cp++) {
42     if ((com = comndx(*cp)) == -1 || *cp == PEOF) {
43     sprintf(errmsg, "unknown option '%c'", *cp);
44     error(WARNING, errmsg);
45     }
46     else
47     exlist[com] = i;
48     }
49     argv++;
50     argc--;
51     }
52    
53     if (argc)
54     while (argc) {
55     fp = efopen(*argv, "r");
56     expand(fp, exlist);
57     fclose(fp);
58     argv++;
59     argc--;
60     }
61     else
62     expand(stdin, exlist);
63    
64     writeof(stdout);
65    
66     return(0);
67     }