ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/pexpand.c
Revision: 1.1
Committed: Sat Feb 22 02:07:26 2003 UTC (21 years, 2 months 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

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id$";
3 #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 #ifdef CPM
34 fixargs("pexpand", &argc, &argv);
35 #endif
36
37 progname = *argv++;
38 argc--;
39
40 for (i = 0; i < NCOMMANDS; i++)
41 exlist[i] = 0;
42
43 while (argc && (**argv == '+' || **argv == '-')) {
44 i = (**argv == '+') ? 1 : -1;
45 for (cp = *argv+1; *cp ; cp++) {
46 if ((com = comndx(*cp)) == -1 || *cp == PEOF) {
47 sprintf(errmsg, "unknown option '%c'", *cp);
48 error(WARNING, errmsg);
49 }
50 else
51 exlist[com] = i;
52 }
53 argv++;
54 argc--;
55 }
56
57 if (argc)
58 while (argc) {
59 fp = efopen(*argv, "r");
60 expand(fp, exlist);
61 fclose(fp);
62 argv++;
63 argc--;
64 }
65 else
66 expand(stdin, exlist);
67
68 writeof(stdout);
69
70 return(0);
71 }