ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/xform.c
(Generate patch)

Comparing ray/src/gen/xform.c (file contents):
Revision 1.8 by greg, Thu Oct 5 09:49:04 1989 UTC vs.
Revision 1.10 by greg, Wed Jan 24 09:16:03 1990 UTC

# Line 122 | Line 122 | char  *argv[];
122                  if (argv[a][0] == '-')
123                          switch (argv[a][1]) {
124                          case 'n':
125 +                                if (argv[a][2] || a+1 >= argc)
126 +                                        break;
127                                  idprefix = argv[++a];
128                                  continue;
129                          case 'e':
130 +                                if (argv[a][2])
131 +                                        break;
132                                  expand = 1;
133                                  continue;
134                          }
# Line 142 | Line 146 | char  *argv[];
146          if (reverse = totscale < 0.0)
147                  totscale = -totscale;
148  
149 <        xac = a;
149 >        if (a < argc && argv[a][0] == '-') {
150 >                fprintf(stderr, "%s: command line error at '%s'\n",
151 >                                argv[0], argv[a]);
152 >                exit(1);
153 >        }
154  
155 <        putchar('#');                           /* simple header */
155 >        xac = a;
156 >                                        /* simple header */
157 >        putchar('#');
158          for (a = 0; a < xac; a++)
159                  printf(" %s", xav[a]);
160          putchar('\n');
161 <
162 <        if (a == argc)
161 >                                        /* transform input */
162 >        if (xac == argc)
163                  xform("standard input", stdin);
164          else
165 <                for ( ; a < argc; a++) {
165 >                for (a = xac; a < argc; a++) {
166                          if ((fp = fopen(argv[a], "r")) == NULL) {
167                                  fprintf(stderr, "%s: cannot open \"%s\"\n",
168                                                  progname, argv[a]);
# Line 244 | Line 254 | FILE  *fin;
254  
255          fgetline(buf, sizeof(buf), fin);
256          if (expand) {
257 <                if ((pin = popen(buf+1, "r")) == NULL) {
258 <                        fprintf(stderr, "%s: (%s): cannot execute \"%s\"\n",
259 <                                        progname, fname, buf);
260 <                        exit(1);
257 >                if (xac > 2) {
258 >                        if ((pin = popen(buf+1, "r")) == NULL) {
259 >                                fprintf(stderr,
260 >                                "%s: (%s): cannot execute \"%s\"\n",
261 >                                                progname, fname, buf);
262 >                                exit(1);
263 >                        }
264 >                        xform(buf, pin);
265 >                        pclose(pin);
266 >                } else {
267 >                        fflush(stdout);
268 >                        system(buf+1);
269                  }
252                xform(buf, pin);
253                pclose(pin);
270          } else {
271 <                printf("\n%s | %s -e", buf, xav[0]);
272 <                for (i = 1; i < xac; i++)
273 <                        printf(" %s", xav[i]);
271 >                printf("\n%s", buf);
272 >                if (xac > 1) {
273 >                        printf(" | %s -e", xav[0]);
274 >                        for (i = 1; i < xac; i++)
275 >                                printf(" %s", xav[i]);
276 >                }
277                  putchar('\n');
278          }
279   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines