1 |
< |
/* Copyright (c) 1987 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
306 |
|
int typ; |
307 |
|
register union {int i; double d; COLOR C;} *ptr; |
308 |
|
{ |
309 |
+ |
extern char *index(); |
310 |
|
int i0; |
311 |
|
double d0, d1, d2; |
312 |
|
char buf[48]; |
340 |
|
sprintf(buf, " (%c): ", ptr->i ? 'y' : 'n'); |
341 |
|
(*dev->comout)(buf); |
342 |
|
(*dev->comin)(buf, NULL); |
343 |
+ |
if (buf[0] == '\0' || |
344 |
+ |
index("yY+1tTnN-0fF", buf[0]) == NULL) |
345 |
+ |
break; |
346 |
|
} |
347 |
< |
ptr->i = tolower(buf[0]) == 'y'; |
347 |
> |
ptr->i = index("yY+1tT", buf[0]) != NULL; |
348 |
|
break; |
349 |
|
case 'C': /* color */ |
350 |
|
if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) { |
472 |
|
break; |
473 |
|
default:; |
474 |
|
badparam: |
475 |
+ |
*sskip(s) = '\0'; |
476 |
|
sprintf(errmsg, "%s: unknown variable", s); |
477 |
|
error(COMMAND, errmsg); |
478 |
|
break; |
574 |
|
fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp); |
575 |
|
|
576 |
|
scanline = (COLR *)malloc(hresolu*sizeof(COLR)); |
577 |
< |
if (scanline == NULL) |
578 |
< |
error(SYSTEM, "out of memory in writepict"); |
577 |
> |
if (scanline == NULL) { |
578 |
> |
error(COMMAND, "not enough memory!"); |
579 |
> |
fclose(fp); |
580 |
> |
unlink(fname); |
581 |
> |
return; |
582 |
> |
} |
583 |
|
for (y = vresolu-1; y >= 0; y--) { |
584 |
|
getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu); |
585 |
|
if (fwritecolrs(scanline, hresolu, fp) < 0) |
586 |
|
break; |
587 |
|
} |
588 |
+ |
free((char *)scanline); |
589 |
|
if (fclose(fp) < 0) |
590 |
|
error(COMMAND, "write error"); |
581 |
– |
free((char *)scanline); |
591 |
|
} |