--- ray/src/px/ra_ps.c 1992/08/14 14:04:09 2.5 +++ ray/src/px/ra_ps.c 1994/02/10 15:40:12 2.8 @@ -9,6 +9,9 @@ static char SCCSid[] = "$SunId$ LBL"; */ #include +#ifdef MSDOS +#include +#endif #include "color.h" #include "random.h" @@ -21,7 +24,7 @@ char code[] = /* 6-bit code lookup table */ "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@+"; int wrongformat = 0; /* input in wrong format? */ -double pixaspect = 1.0; /* pixel aspect ratio */ +double pixaspect = 1.0; /* pixel aspect ratio */ int bradj = 0; /* brightness adjustment */ int ncopies = 1; /* number of copies */ @@ -30,7 +33,9 @@ char *progname; int xmax, ymax; +extern char *malloc(); + headline(s) /* check header line */ char *s; { @@ -77,10 +82,13 @@ char *argv[]; exit(1); } if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) { - fprintf(stderr, "can't open output \"%s\"\n", + fprintf(stderr, "%s: can't open output \"%s\"\n", progname, argv[i+1]); exit(1); } +#ifdef MSDOS + setmode(fileno(stdin), O_BINARY); +#endif /* get our header */ getheader(stdin, headline, NULL); if (wrongformat || fgetresolu(&xmax, &ymax, stdin) < 0) @@ -113,8 +121,8 @@ PSheader(name) /* print PostScript header */ char *name; { int landscape = 0; - double pwidth, pheight; - double iwidth, iheight; + double pwidth, pheight; + double iwidth, iheight; printf("%%!\n"); printf("%%%%Title: %s\n", name); @@ -190,7 +198,8 @@ char *nam; printf("\t{ 0 1 %d { scanline exch\n", xmax-1); printf("\t\t{ decode currentfile read not {stop} if get\n"); printf("\tdup 0 lt {pop} {exit} ifelse } loop put } for\n"); - printf("} stopped {pop pop pop 0 string} {scanline} ifelse } def\n"); + printf("\t} stopped {pop pop pop 0 string} {scanline} ifelse\n"); + printf("} bind def\n"); } @@ -209,7 +218,7 @@ ra2ps() /* convert Radiance scanlines to 6-bit */ for (y = ymax-1; y >= 0; y--) { if (freadcolrs(scanin, xmax, stdin) < 0) quiterr("error reading Radiance picture"); - normcolrs(scanin, xmax, bradj); /* normalize */ + normcolrs(scanin, xmax, bradj); /* normalize */ for (x = 0; x < xmax; x++) { if (!(col++ & 0x3f)) putchar('\n');