--- ray/src/px/mt160r.c 1991/11/11 14:01:28 1.9 +++ ray/src/px/mt160r.c 2004/03/28 20:33:14 2.8 @@ -1,9 +1,6 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: mt160r.c,v 2.8 2004/03/28 20:33:14 schorsch Exp $"; #endif - /* * mt160r.c - program to dump pixel file to Mannesman-Tally 160. * @@ -11,20 +8,30 @@ static char SCCSid[] = "$SunId$ LBL"; */ #include +#include +#include "platform.h" #include "color.h" #include "resolu.h" -#define NCOLS 880 /* for wide carriage */ +#define NCOLS 880 /* for wide carriage */ +static int printp(char *fname); +static void plotscan(COLR scan[], int len, int y); +static int bit(COLR clr, int x); -main(argc, argv) -int argc; -char *argv[]; + +int +main( + int argc, + char *argv[] +) { int i; int status = 0; - + SET_DEFAULT_BINARY(); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); if (argc < 2) status += printp(NULL) == -1; else @@ -34,14 +41,16 @@ char *argv[]; } -printp(fname) /* print a picture */ -char *fname; +static int +printp( /* print a picture */ + char *fname +) { FILE *input; int xres, yres; COLR scanline[NCOLS]; int i; - + if (fname == NULL) { input = stdin; fname = ""; @@ -83,16 +92,18 @@ char *fname; } -plotscan(scan, len, y) /* plot a scanline */ -COLR scan[]; -int len; -int y; +static void +plotscan( /* plot a scanline */ + COLR scan[], + int len, + int y +) { static BYTE pat[NCOLS]; int bpos; register int i; - if (bpos = y & 7) { + if ((bpos = y & 7)) { for (i = 0; i < len; i++) pat[i] |= bit(scan[i], i) << bpos; @@ -110,17 +121,20 @@ int y; } putchar('\r'); putchar('\n'); + fflush(stdout); } } -bit(clr, x) /* return bit for color at x */ -COLR clr; -register int x; +static int +bit( /* return bit for color at x */ + COLR clr, + register int x +) { static int cerr[NCOLS]; - static int err, errp; - int b; + static int err; + int b, errp; register int isblack; b = normbright(clr);