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

Comparing ray/src/util/rfluxmtx.c (file contents):
Revision 2.11 by greg, Fri Jul 25 19:23:14 2014 UTC vs.
Revision 2.14 by greg, Wed Aug 6 02:38:24 2014 UTC

# Line 11 | Line 11 | static const char RCSid[] = "$Id$";
11   #include <stdlib.h>
12   #include "rtio.h"
13   #include "rtmath.h"
14 + #include "rtprocess.h"
15   #include "bsdf.h"
16   #include "bsdf_m.h"
17   #include "random.h"
# Line 144 | Line 145 | surf_type(const char *otype)
145   static char *
146   oconv_command(int ac, char *av[])
147   {
148 <        static char     oconvbuf[2048] = "!oconv -f";
149 <        char            *cp = oconvbuf + 9;
150 <
148 >        static char     oconvbuf[2048] = "!oconv -f ";
149 >        char            *cp = oconvbuf + 10;
150 >        char            *recv = *av++;
151 >        
152 >        if (ac-- <= 0)
153 >                return(NULL);
154          while (ac-- > 0) {
155 +                strcpy(cp, *av++);
156 +                while (*cp) cp++;
157 +                *cp++ = ' ';
158                  if (cp >= oconvbuf+(sizeof(oconvbuf)-32)) {
159                          fputs(progname, stderr);
160                          fputs(": too many file arguments!\n", stderr);
161                          exit(1);
162                  }
156                *cp++ = ' ';
157                strcpy(cp, *av++);
158                while (*cp) cp++;
163          }
164 <        *cp = '\0';
164 >        strcpy(cp, recv);       /* receiver goes last */
165          return(oconvbuf);
166   }
167  
# Line 1182 | Line 1186 | main(int argc, char *argv[])
1186          int     a, i;
1187                                          /* screen rcontrib options */
1188          progname = argv[0];
1189 <        for (a = 1; a < argc-2 && argv[a][0] == '-'; a++) {
1190 <                int     na = 1;         /* !! Keep consistent !! */
1191 <                switch (argv[a][1]) {
1189 >        for (a = 1; a < argc-2; a++) {
1190 >                int     na;
1191 >                                        /* check for argument expansion */
1192 >                while ((na = expandarg(&argc, &argv, a)) > 0)
1193 >                        ;
1194 >                if (na < 0) {
1195 >                        fprintf(stderr, "%s: cannot expand '%s'\n",
1196 >                                        progname, argv[a]);
1197 >                        return(1);
1198 >                }
1199 >                if (argv[a][0] != '-' || !argv[a][1])
1200 >                        break;
1201 >                na = 1;
1202 >                switch (argv[a][1]) {   /* !! Keep consistent !! */
1203                  case 'v':               /* verbose mode */
1204                          verbose = !verbose;
1205                          na = 0;
# Line 1259 | Line 1274 | main(int argc, char *argv[])
1274                          if (!argv[a][2]) goto userr;
1275                          na = (argv[a][2] == 'e') | (argv[a][2] == 'a') ? 4 : 2;
1276                          break;
1262                case '\0':              /* pass-through mode */
1263                        goto done_opts;
1277                  default:                /* anything else is verbotten */
1278                          goto userr;
1279                  }
# Line 1270 | Line 1283 | main(int argc, char *argv[])
1283                  while (--na)            /* + arguments if any */
1284                          rcarg[nrcargs++] = argv[++a];
1285          }
1273 done_opts:
1286          if (a > argc-2)
1287                  goto userr;             /* check at end of options */
1288          sendfn = argv[a++];             /* assign sender & receiver inputs */
# Line 1352 | Line 1364 | done_opts:
1364   userr:
1365          if (a < argc-2)
1366                  fprintf(stderr, "%s: unsupported option '%s'", progname, argv[a]);
1367 <        fprintf(stderr, "Usage: %s [-v][rcontrib options] sender.rad receiver.rad [system.rad ..]\n",
1367 >        fprintf(stderr, "Usage: %s [-v][rcontrib options] sender.rad receiver.rad [-i system.oct] [system.rad ..]\n",
1368                                  progname);
1369          return(1);
1370   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines