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

Comparing ray/src/common/loadvars.c (file contents):
Revision 2.2 by greg, Wed Jan 17 15:45:16 1996 UTC vs.
Revision 2.5 by greg, Thu Mar 20 12:29:20 1997 UTC

# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18   extern char  *malloc(), *realloc();
19   #endif
20  
21 + extern char  *fgetline();
22  
23 +
24   loadvars(rfname)                /* load variables into vv from file */
25   char    *rfname;
26   {
# Line 30 | Line 32 | char   *rfname;
32                  fp = stdin;
33          else if ((fp = fopen(rfname, "r")) == NULL) {
34                  perror(rfname);
35 <                exit(1);
35 >                quit(1);
36          }
37          while (fgetline(buf, sizeof(buf), fp) != NULL) {
38                  for (cp = buf; *cp; cp++) {
# Line 76 | Line 78 | register char  *ass;
78          for (n = strlen(ass); n > 0; n--)
79                  if (!isspace(ass[n-1]))
80                          break;
81 <        if (!n && !nowarn) {
82 <                fprintf(stderr, "%s: warning - missing value for variable '%s'\n",
83 <                                progname, varname);
81 >        if (!n) {
82 >                if (!nowarn)
83 >                        fprintf(stderr,
84 >                        "%s: warning - missing value for variable '%s'\n",
85 >                                        progname, varname);
86                  return;
87          }
88                                          /* match variable from list */
# Line 86 | Line 90 | register char  *ass;
90          if (vp == NULL) {
91                  fprintf(stderr, "%s: unknown variable '%s'\n",
92                                  progname, varname);
93 <                exit(1);
93 >                quit(1);
94          }
95                                          /* assign new value */
96          if (i = vp->nass) {
# Line 100 | Line 104 | register char  *ass;
104                  vp->value = malloc(n+1);
105          if (vp->value == NULL) {
106                  perror(progname);
107 <                exit(1);
107 >                quit(1);
108          }
109          cp = vp->value+i;               /* copy value, squeezing spaces */
110          *cp = *ass;
# Line 217 | Line 221 | register VARIABLE      *vp;
221          }
222          fprintf(stderr, "%s: illegal value for boolean variable '%s'\n",
223                          progname, vp->name);
224 <        exit(1);
224 >        quit(1);
225   }
226  
227  
# Line 239 | Line 243 | register VARIABLE      *vp;
243          }
244          fprintf(stderr, "%s: illegal value for qualitative variable '%s'\n",
245                          progname, vp->name);
246 <        exit(1);
246 >        quit(1);
247   }
248  
249  
# Line 251 | Line 255 | register VARIABLE      *vp;
255          if (isint(vp->value)) return;
256          fprintf(stderr, "%s: illegal value for integer variable '%s'\n",
257                          progname, vp->name);
258 <        exit(1);
258 >        quit(1);
259   }
260  
261  
# Line 263 | Line 267 | register VARIABLE      *vp;
267          if (isflt(vp->value)) return;
268          fprintf(stderr, "%s: illegal value for real variable '%s'\n",
269                          progname, vp->name);
270 <        exit(1);
270 >        quit(1);
271   }
272  
273  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines