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.20 by greg, Thu Sep 9 13:47:55 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 char  rifname[128];              /* rad input file name */
36  
37   extern char  VersionID[];
38   extern char  *progname;
# Line 163 | Line 163 | char  *s;
163  
164          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
165                  copystruct(&nv, &stdview);
166 <                if ((fname = getpath(buf, NULL, 0)) == NULL ||
166 >                if ((fname = getpath(buf, "", R_OK)) == NULL ||
167                                  (success = viewfile(fname, &nv, NULL)) == -1) {
168                          sprintf(errmsg, "cannot open \"%s\"", buf);
169                          error(COMMAND, errmsg);
# Line 193 | Line 193 | char  *s;
193          char  *fname;
194          FILE  *fp;
195  
196 <        if (*atos(view, sizeof(view), s))
196 >        if (*atos(view, sizeof(view), s)) {
197 >                if (isint(view)) {
198 >                        error(COMMAND, "cannot write view by number");
199 >                        return;
200 >                }
201                  s = sskip(s);
202 <        if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') {
202 >        }
203 >        while (isspace(*s))
204 >                s++;
205 >        if (*s)
206 >                atos(rifname, sizeof(rifname), s);
207 >        else if (rifname[0] == '\0') {
208                  error(COMMAND, "no previous rad file");
209                  return;
210          }
# Line 226 | Line 235 | char  *s;
235                  s = sskip(s);
236          else
237                  strcat(buf, "1");
238 <        if (sscanf(s, "%s", rifname) != 1 && rifname[0] == '\0') {
238 >        if (*s)
239 >                atos(rifname, sizeof(rifname), s);
240 >        else if (rifname[0] == '\0') {
241                  error(COMMAND, "no previous rad file");
242                  return;
243          }
244 <        fname = getpath(rifname, NULL, 0);
234 <        if (fname == NULL || access(fname, R_OK) == -1) {
244 >        if ((fname = getpath(rifname, "", R_OK)) == NULL) {
245                  sprintf(errmsg, "cannot access \"%s\"", rifname);
246                  error(COMMAND, errmsg);
247                  return;
# Line 658 | Line 668 | char  *s;
668          COLR  *scanline;
669          int  y;
670  
671 <        if (sscanf(s, "%s", buf) != 1 && buf[0] == '\0') {
671 >        while (isspace(*s))
672 >                s++;
673 >        if (*s)
674 >                atos(buf, sizeof(buf), s);
675 >        else if (buf[0] == '\0') {
676                  error(COMMAND, "no file");
677                  return;
678          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines