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

Comparing ray/src/util/rtcontrib.c (file contents):
Revision 1.34 by greg, Tue Oct 11 04:27:41 2005 UTC vs.
Revision 1.35 by greg, Tue Oct 11 16:54:26 2005 UTC

# Line 123 | Line 123 | int            inpfmt = 'a';           /* input format */
123   int             outfmt = 'a';           /* output format */
124  
125   int             header = 1;             /* output header? */
126 + int             force_open = 0;         /* truncate existing output? */
127   int             xres = 0;               /* horiz. output resolution */
128   int             yres = 0;               /* vert. output resolution */
129  
# Line 266 | Line 267 | main(int argc, char *argv[])
267                                          continue;
268                                  }
269                                  break;
270 <                        case 'f':               /* file or i/o format */
270 >                        case 'f':               /* file or force or format */
271                                  if (!argv[i][2]) {
272                                          char    *fpath;
273                                          if (i >= argc-2) break;
# Line 281 | Line 282 | main(int argc, char *argv[])
282                                          fcompile(fpath);
283                                          continue;
284                                  }
285 +                                if (argv[i][2] == 'o') {
286 +                                        force_open++;
287 +                                        continue;
288 +                                }
289                                  setformat(argv[i]+2);
290                                  continue;
291                          case 'e':               /* expression */
# Line 710 | Line 715 | getostream(const char *ospec, const char *mname, int b
715                  long            i;
716                  if (oname[0] == '!')            /* output to command */
717                          sop->ofp = popen(oname+1, "w");
718 <                else
718 >                else if (!force_open && access(oname, F_OK) == 0)
719 >                        errno = EEXIST;         /* file exists */
720 >                else                            /* else open it */
721                          sop->ofp = fopen(oname, "w");
722                  if (sop->ofp == NULL) {
723                          sprintf(errmsg, "cannot open '%s' for writing", oname);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines