--- ray/src/px/oki20.c 1992/07/03 10:30:07 2.4 +++ ray/src/px/oki20.c 2003/02/22 02:07:27 2.9 @@ -1,49 +1,48 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: oki20.c,v 2.9 2003/02/22 02:07:27 greg Exp $"; #endif - /* - * oki20c.c - program to dump pixel file to OkiMate 20 color printer. + * oki20.c - program to dump pixel file to OkiMate 20 printer. */ #include +#ifdef MSDOS +#include +#endif +#include #include "color.h" #include "resolu.h" -#define NROWS 1440 /* 10" at 144 dpi */ -#define NCOLS 960 /* 8" at 120 dpi */ +#define NROWS 1440 /* 10" at 144 dpi */ +#define NCOLS 960 /* 8" at 120 dpi */ -#define ASPECT (120./144.) /* pixel aspect ratio */ +#define ASPECT (120./144.) /* pixel aspect ratio */ -#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT +#define FILTER "pfilt -1 -x %d -y %d -p %f %s",NCOLS,NROWS,ASPECT -#ifdef BSD -#define clearlbuf() bzero((char *)lpat, sizeof(lpat)) -#else -#define clearlbuf() (void)memset((char *)lpat, 0, sizeof(lpat)) -#endif - long lpat[NCOLS]; int dofilter = 0; /* filter through pfilt first? */ +extern FILE *popen(); + main(argc, argv) int argc; char *argv[]; { int i, status = 0; - +#ifdef MSDOS + extern int _fmode; + _fmode = O_BINARY; + setmode(fileno(stdin), O_BINARY); + setmode(fileno(stdout), O_BINARY); +#endif if (argc > 1 && !strcmp(argv[1], "-p")) { dofilter++; argv++; argc--; } -#ifdef _IOLBF - stdout->_flag &= ~_IOLBF; -#endif if (argc < 2) status = printp(NULL) == -1; else @@ -95,8 +94,6 @@ char *fname; } /* set line spacing (overlap for knitting) */ fputs("\0333\042\022", stdout); - /* clear line buffer */ - clearlbuf(); /* put out scanlines */ for (i = yres-1; i >= 0; i--) { if (freadcolrs(scanline, xres, input) < 0) { @@ -154,11 +151,13 @@ int y; putchar(i >> 8); for (i = start; i <= end; i++) { c = lpat[i]; - putchar(c>>16); - putchar(c>>8 & 255); - putchar(c & 255); - /* repeat this row next time */ - lpat[i] = (c & 1) << 23; + putchar((int)(c>>16)); + putchar((int)(c>>8 & 255)); + putchar((int)(c & 255)); + if (y) /* repeat this row next time */ + lpat[i] = (c & 1) << 23; + else /* or clear for next image */ + lpat[i] = 0L; } putchar('\r'); putchar('\n');