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.18 by greg, Wed Aug 25 14:13:51 1993 UTC vs.
Revision 2.21 by greg, Thu Sep 9 14:57:53 1993 UTC

# Line 32 | Line 32 | static char SCCSid[] = "$SunId$ LBL";
32  
33   extern char  *atos();
34  
35 < extern char  rifname[];                 /* rad input file name */
35 > extern FILE  *popen();
36  
37 + extern char  rifname[128];              /* rad input file name */
38 +
39   extern char  VersionID[];
40   extern char  *progname;
41   extern char  *octname;
# Line 163 | Line 165 | char  *s;
165  
166          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
167                  copystruct(&nv, &stdview);
168 <                if ((fname = getpath(buf, NULL, 0)) == NULL ||
168 >                if ((fname = getpath(buf, "", R_OK)) == NULL ||
169                                  (success = viewfile(fname, &nv, NULL)) == -1) {
170                          sprintf(errmsg, "cannot open \"%s\"", buf);
171                          error(COMMAND, errmsg);
# Line 193 | Line 195 | char  *s;
195          char  *fname;
196          FILE  *fp;
197  
198 <        if (*atos(view, sizeof(view), s))
198 >        if (*atos(view, sizeof(view), s)) {
199 >                if (isint(view)) {
200 >                        error(COMMAND, "cannot write view by number");
201 >                        return;
202 >                }
203                  s = sskip(s);
204 <        if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') {
204 >        }
205 >        while (isspace(*s))
206 >                s++;
207 >        if (*s)
208 >                atos(rifname, sizeof(rifname), s);
209 >        else if (rifname[0] == '\0') {
210                  error(COMMAND, "no previous rad file");
211                  return;
212          }
# Line 226 | Line 237 | char  *s;
237                  s = sskip(s);
238          else
239                  strcat(buf, "1");
240 <        if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') {
240 >        if (*s)
241 >                atos(rifname, sizeof(rifname), s);
242 >        else if (rifname[0] == '\0') {
243                  error(COMMAND, "no previous rad file");
244                  return;
245          }
246 <        fname = getpath(rifname, NULL, 0);
234 <        if (fname == NULL || access(fname, R_OK) == -1) {
246 >        if ((fname = getpath(rifname, "", R_OK)) == NULL) {
247                  sprintf(errmsg, "cannot access \"%s\"", rifname);
248                  error(COMMAND, errmsg);
249                  return;
# Line 658 | Line 670 | char  *s;
670          COLR  *scanline;
671          int  y;
672  
673 <        if (sscanf(s, "%s", buf) != 1 && buf[0] == '\0') {
673 >        while (isspace(*s))
674 >                s++;
675 >        if (*s)
676 >                atos(buf, sizeof(buf), s);
677 >        else if (buf[0] == '\0') {
678                  error(COMMAND, "no file");
679                  return;
680          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines