ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/pexpand.c
Revision: 1.3
Committed: Sat Nov 15 02:13:37 2003 UTC (21 years, 1 month ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1, rad5R3, HEAD
Changes since 1.2: +6 -8 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: pexpand.c,v 1.2 2003/08/01 14:14:24 schorsch 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     char *progname;
15    
16     int maxalloc = 0; /* no limit */
17    
18    
19 schorsch 1.3 int
20     main(
21     int argc,
22     char **argv
23     )
24 greg 1.1 {
25     FILE *fp;
26     int i;
27     char *cp;
28     int com;
29     short exlist[NCOMMANDS]; /* 1==expand, 0==pass, -1==discard */
30    
31     progname = *argv++;
32     argc--;
33    
34     for (i = 0; i < NCOMMANDS; i++)
35     exlist[i] = 0;
36    
37     while (argc && (**argv == '+' || **argv == '-')) {
38     i = (**argv == '+') ? 1 : -1;
39     for (cp = *argv+1; *cp ; cp++) {
40     if ((com = comndx(*cp)) == -1 || *cp == PEOF) {
41     sprintf(errmsg, "unknown option '%c'", *cp);
42     error(WARNING, errmsg);
43     }
44     else
45     exlist[com] = i;
46     }
47     argv++;
48     argc--;
49     }
50    
51     if (argc)
52     while (argc) {
53     fp = efopen(*argv, "r");
54     expand(fp, exlist);
55     fclose(fp);
56     argv++;
57     argc--;
58     }
59     else
60     expand(stdin, exlist);
61    
62     writeof(stdout);
63    
64     return(0);
65     }