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.5 by greg, Thu May 26 21:35:35 2005 UTC vs.
Revision 1.10 by greg, Thu Jun 2 04:47:27 2005 UTC

# Line 7 | Line 7 | static const char RCSid[] = "$Id$";
7  
8   #include  "standard.h"
9   #include  <ctype.h>
10 + #include  <signal.h>
11   #include  "platform.h"
12   #include  "rtprocess.h"
13   #include  "selcall.h"
# Line 66 | Line 67 | struct rtproc {
67   };                              /* rtrace process buffer */
68  
69                                          /* rtrace command and defaults */
70 < char            *rtargv[256] = { "rtrace", "-dt", "0", "-dj", ".5", "-dr", "3",
71 <                                "-ab", "1", "-ad", "128", };
70 > char            *rtargv[256] = { "rtrace", "-dj", ".5", "-dr", "3",
71 >                                "-ab", "1", "-ad", "128", "-lr", "-10", };
72   int  rtargc = 11;
73                                          /* overriding rtrace options */
74 < char            *myrtopts[] = { "-o~~TmWdp", "-h-",
75 <                                "-x", "1", "-y", "0",
75 <                                "-as", "0", "-aa", "0", NULL };
74 > char            *myrtopts[] = { "-o~~TmWdp", "-h-", "-x", "1", "-y", "0",
75 >                                "-dt", "0", "-as", "0", "-aa", "0", NULL };
76  
77   struct rtproc   rt0;                    /* head of rtrace process list */
78  
# Line 123 | Line 123 | static void
123   setformat(const char *fmt)
124   {
125          switch (fmt[0]) {
126        case 'a':
126          case 'f':
127          case 'd':
128 +                SET_FILE_BINARY(stdin);
129 +                /* fall through */
130 +        case 'a':
131                  inpfmt = fmt[0];
132                  break;
133          default:
# Line 202 | Line 204 | main(int argc, char *argv[])
204                                  break;
205                          case 'f':               /* file or i/o format */
206                                  if (!argv[i][2]) {
207 +                                        char    *fpath;
208                                          if (i >= argc-1) break;
209 <                                        fcompile(argv[++i]);
209 >                                        fpath = getpath(argv[++i],
210 >                                                        getrlibpath(), R_OK);
211 >                                        if (fpath == NULL) {
212 >                                                sprintf(errmsg,
213 >                                                        "cannot find file '%s'",
214 >                                                                argv[i]);
215 >                                                error(USER, errmsg);
216 >                                        }
217 >                                        fcompile(fpath);
218                                          continue;
219                                  }
220                                  setformat(argv[i]+2);
# Line 489 | Line 500 | getofile(const char *ospec, const char *mname, int bn)
500          LUENT           *lep;
501          
502          if (ospec == NULL) {                    /* use stdout? */
503 <                if (!using_stdout && header)
504 <                        printheader(stdout);
503 >                if (!using_stdout) {
504 >                        if (outfmt != 'a')
505 >                                SET_FILE_BINARY(stdout);
506 >                        if (header)
507 >                                printheader(stdout);
508 >                }
509                  using_stdout = 1;
510                  return stdout;
511          }
# Line 532 | Line 547 | getofile(const char *ospec, const char *mname, int bn)
547          if (lep->key == NULL)                   /* new entry */
548                  lep->key = strcpy((char *)malloc(strlen(ofname)+1), ofname);
549          if (lep->data == NULL) {                /* open output file */
550 <                FILE            *fp = fopen(ofname, "w");
550 >                FILE            *fp;
551                  int             i;
552 +                if (ofname[0] == '!')           /* output to command */
553 +                        fp = popen(ofname+1, "w");
554 +                else
555 +                        fp = fopen(ofname, "w");
556                  if (fp == NULL) {
557                          sprintf(errmsg, "cannot open '%s' for writing", ofname);
558                          error(SYSTEM, errmsg);
559                  }
560 +                if (outfmt != 'a')
561 +                        SET_FILE_BINARY(fp);
562                  if (header)
563                          printheader(fp);
564                                                  /* play catch-up */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines