| 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 |
|
{ |
| 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++) { |
| 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) { |
| 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; |
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|