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

Comparing ray/src/rt/rv2.c (file contents):
Revision 2.61 by greg, Wed Oct 20 16:36:10 2010 UTC vs.
Revision 2.62 by greg, Wed Oct 5 17:20:55 2011 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  <string.h>
14  
15   #include  "platform.h"
16 + #include  "rtprocess.h" /* win_popen() */
17 + #include  "paths.h"
18   #include  "ray.h"
19   #include  "source.h"
20   #include  "ambient.h"
# Line 61 | Line 63 | getrepaint(                            /* get area and repaint */
63  
64  
65   void
66 < getview(                                /* get/show view parameters */
66 > getview(                                /* get/show/save view parameters */
67          char  *s
68   )
69   {
# Line 80 | Line 82 | getview(                               /* get/show view parameters */
82                          error(COMMAND, "bad view option(s)");
83                  return;
84          }
85 <        if (sscanf(s, "%s", buf) == 1) {        /* write parameters to a file */
85 >        if (nextword(buf, sizeof(buf), s) != NULL) {    /* write to a file */
86                  if ((fname = getpath(buf, NULL, 0)) == NULL ||
87                                  (fp = fopen(fname, "a")) == NULL) {
88                          sprintf(errmsg, "cannot open \"%s\"", buf);
# Line 162 | Line 164 | lastview(                              /* return to a previous view */
164          char  *fname;
165          int  success;
166          VIEW  nv;
167 <
168 <        if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
167 >                                        /* get parameters from a file */
168 >        if (nextword(buf, sizeof(buf), s) != NULL) {
169                  nv = stdview;
170                  if ((fname = getpath(buf, "", R_OK)) == NULL ||
171                                  (success = viewfile(fname, &nv, NULL)) == -1) {
# Line 204 | Line 206 | saveview(                              /* save view to rad file */
206                  }
207                  s = sskip(s);
208          }
209 <        while (isspace(*s))
208 <                s++;
209 <        if (*s)
210 <                atos(rifname, sizeof(rifname), s);
211 <        else if (rifname[0] == '\0') {
209 >        if (nextword(rifname, sizeof(rifname), s) == NULL && !rifname[0]) {
210                  error(COMMAND, "no previous rad file");
211                  return;
212          }
# Line 241 | Line 239 | loadview(                              /* load view from rad file */
239                  s = sskip(s);
240          else
241                  strcat(buf, "1");
242 <        if (*s)
245 <                atos(rifname, sizeof(rifname), s);
246 <        else if (rifname[0] == '\0') {
242 >        if (nextword(rifname, sizeof(rifname), s) == NULL && !rifname[0]) {
243                  error(COMMAND, "no previous rad file");
244                  return;
245          }
# Line 804 | Line 800 | writepict(                             /* write the picture to a file */
800          FILE  *fp;
801          COLR  *scanline;
802          int  y;
803 <
804 <        while (isspace(*s))
809 <                s++;
810 <        if (*s)
811 <                atos(buf, sizeof(buf), s);
812 <        else if (buf[0] == '\0') {
803 >                                /* XXX relies on words.c 2.11 behavior */
804 >        if (nextword(buf, sizeof(buf), s) == NULL && !buf[0]) {
805                  error(COMMAND, "no file");
806                  return;
807          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines