542 |
|
writepict(s) /* write the picture to a file */ |
543 |
|
char *s; |
544 |
|
{ |
545 |
+ |
extern char VersionID[]; |
546 |
|
static char buf[128]; |
547 |
|
char *fname; |
548 |
|
FILE *fp; |
566 |
|
fputs(progname, fp); |
567 |
|
fprintview(&ourview, fp); |
568 |
|
putc('\n', fp); |
569 |
+ |
fprintf(fp, "SOFTWARE= %s\n", VersionID); |
570 |
|
if (exposure != 1.0) |
571 |
|
fputexpos(exposure, fp); |
572 |
|
if (dev->pixaspect != 1.0) |
576 |
|
fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp); |
577 |
|
|
578 |
|
scanline = (COLR *)malloc(hresolu*sizeof(COLR)); |
579 |
< |
if (scanline == NULL) |
580 |
< |
error(SYSTEM, "out of memory in writepict"); |
579 |
> |
if (scanline == NULL) { |
580 |
> |
error(COMMAND, "not enough memory!"); |
581 |
> |
fclose(fp); |
582 |
> |
unlink(fname); |
583 |
> |
return; |
584 |
> |
} |
585 |
|
for (y = vresolu-1; y >= 0; y--) { |
586 |
|
getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu); |
587 |
|
if (fwritecolrs(scanline, hresolu, fp) < 0) |
588 |
|
break; |
589 |
|
} |
590 |
+ |
free((char *)scanline); |
591 |
|
if (fclose(fp) < 0) |
592 |
|
error(COMMAND, "write error"); |
586 |
– |
free((char *)scanline); |
593 |
|
} |