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.10 by greg, Fri Jul 25 17:03:06 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 1174 | Line 1178 | main(int argc, char *argv[])
1178   {
1179          char    fmtopt[6] = "-faa";     /* default output is ASCII */
1180          char    *xrs=NULL, *yrs=NULL, *ldopt=NULL;
1181 <        int     wantIrradiance = 0;
1181 >        char    *iropt = NULL;
1182          char    *sendfn;
1183          char    sampcntbuf[32], nsbinbuf[32];
1184          FILE    *rcfp;
# 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 1223 | Line 1238 | main(int argc, char *argv[])
1238                          na = 0;         /* we re-add this later */
1239                          continue;
1240                  case 'I':               /* only for pass-through mode */
1241 <                        wantIrradiance = 1;
1241 >                case 'i':
1242 >                        iropt = argv[a];
1243                          na = 0;
1244                          continue;
1245                  case 'V':               /* options without arguments */
1246                  case 'w':
1247                  case 'u':
1232                case 'i':
1248                  case 'h':
1249                  case 'r':
1250                          break;
# 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 */
1289          if (sendfn[0] == '-') {         /* user wants pass-through mode? */
1290                  if (sendfn[1]) goto userr;
1291                  sendfn = NULL;
1292 <                if (wantIrradiance) {
1292 >                if (iropt) {
1293                          CHECKARGC(1);
1294 <                        rcarg[nrcargs++] = "-I";
1294 >                        rcarg[nrcargs++] = iropt;
1295                  }
1296                  if (xrs) {
1297                          CHECKARGC(2);
# Line 1297 | Line 1309 | done_opts:
1309                  }
1310                  if (sampcnt <= 0) sampcnt = 1;
1311          } else {                        /* else in sampling mode */
1312 <                if (wantIrradiance) {
1312 >                if (iropt) {
1313                          fputs(progname, stderr);
1314 <                        fputs(": -I supported for pass-through only\n", stderr);
1314 >                        fputs(": -i, -I supported for pass-through only\n", stderr);
1315                          return(1);
1316                  }
1317                  fmtopt[2] = (sizeof(RREAL)==sizeof(double)) ? 'd' : 'f';
# 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