--- ray/src/util/getinfo.c 1990/06/28 16:39:32 1.2 +++ ray/src/util/getinfo.c 2003/02/22 02:07:30 2.5 @@ -1,9 +1,6 @@ -/* Copyright (c) 1986 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: getinfo.c,v 2.5 2003/02/22 02:07:30 greg Exp $"; #endif - /* * getinfo.c - program to read info. header from file. * @@ -12,7 +9,15 @@ static char SCCSid[] = "$SunId$ LBL"; #include +#ifdef MSDOS +#include +extern int _fmode; +#endif +extern int fputs(); + + +int tabstr(s) /* put out line followed by tab */ register char *s; { @@ -22,12 +27,13 @@ register char *s; } if (*--s == '\n') putchar('\t'); + return(0); } main(argc, argv) int argc; -char *argv[]; +char **argv; { int dim = 0; FILE *fp; @@ -36,8 +42,15 @@ char *argv[]; if (argc > 1 && !strcmp(argv[1], "-d")) { argc--; argv++; dim = 1; +#ifdef MSDOS + setmode(fileno(stdin), _fmode = O_BINARY); +#endif } else if (argc == 2 && !strcmp(argv[1], "-")) { - getheader(stdin, NULL); +#ifdef MSDOS + setmode(fileno(stdin), O_BINARY); + setmode(fileno(stdout), O_BINARY); +#endif + getheader(stdin, NULL, NULL); copycat(); exit(0); } @@ -51,7 +64,7 @@ char *argv[]; getdim(fp); } else { tabstr(":\n"); - getheader(fp, tabstr); + getheader(fp, tabstr, NULL); putchar('\n'); } fclose(fp); @@ -61,7 +74,7 @@ char *argv[]; if (dim) { getdim(stdin); } else { - copyheader(stdin, stdout); + getheader(stdin, fputs, stdout); putchar('\n'); } exit(0); @@ -74,7 +87,7 @@ register FILE *fp; int j; register int c; - getheader(fp, NULL); /* skip header */ + getheader(fp, NULL, NULL); /* skip header */ switch (c = getc(fp)) { case '+': /* picture */