--- ray/src/px/ttyimage.c 1990/01/26 08:17:41 1.6 +++ ray/src/px/ttyimage.c 1992/09/21 12:15:22 2.2 @@ -1,4 +1,4 @@ -/* Copyright (c) 1986 Regents of the University of California */ +/* Copyright (c) 1992 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -11,11 +11,15 @@ static char SCCSid[] = "$SunId$ LBL"; */ #include +#ifdef MSDOS +#include +#endif #include "color.h" +#include "resolu.h" -#define NCOLS 133 +#define NCOLS 133 main(argc, argv) @@ -33,12 +37,13 @@ char **argv; fprintf(stderr, "%s: can't open file \"%s\"\n", argv[0], argv[1]); exit(1); } - - /* discard header */ - getheader(input, NULL); +#ifdef MSDOS + setmode(fileno(input), O_BINARY); +#endif /* get picture dimensions */ - if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { - fprintf(stderr, "%s: bad picture size\n", argv[0]); + if (checkheader(input, COLRFMT, NULL) < 0 || + fgetresolu(&xres, &yres, input) < 0) { + fprintf(stderr, "%s: bad picture format\n", argv[0]); exit(1); } if (xres > NCOLS) { @@ -65,7 +70,7 @@ int shade(clr) /* return character for color */ COLR clr; { -#define NSHADES 13 +#define NSHADES 13 static char shadech[NSHADES+1] = " .,:;+?%&*$@#";