--- ray/src/util/getinfo.c 1991/04/18 14:35:06 1.3 +++ ray/src/util/getinfo.c 2004/01/02 11:44:24 2.8 @@ -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.8 2004/01/02 11:44:24 schorsch Exp $"; #endif - /* * getinfo.c - program to read info. header from file. * @@ -11,12 +8,21 @@ static char SCCSid[] = "$SunId$ LBL"; */ #include +#include -extern int fputs(); +#include "platform.h" +#include "resolu.h" +static gethfunc tabstr; +static void getdim(register FILE *fp); +static void copycat(void); -tabstr(s) /* put out line followed by tab */ -register char *s; + +static int +tabstr( /* put out line followed by tab */ + register char *s, + void *p +) { while (*s) { putchar(*s); @@ -24,12 +30,15 @@ register char *s; } if (*--s == '\n') putchar('\t'); + return(0); } -main(argc, argv) -int argc; -char *argv[]; +int +main( + int argc, + char **argv +) { int dim = 0; FILE *fp; @@ -38,10 +47,14 @@ char *argv[]; if (argc > 1 && !strcmp(argv[1], "-d")) { argc--; argv++; dim = 1; + SET_DEFAULT_BINARY(); /* for output file */ + SET_FILE_BINARY(stdin); } else if (argc == 2 && !strcmp(argv[1], "-")) { - getheader(stdin, NULL); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); + getheader(stdin, NULL, NULL); copycat(); - exit(0); + return 0; } for (i = 1; i < argc; i++) { fputs(argv[i], stdout); @@ -52,31 +65,34 @@ char *argv[]; fputs(": ", stdout); getdim(fp); } else { - tabstr(":\n"); + tabstr(":\n", NULL); getheader(fp, tabstr, NULL); putchar('\n'); } fclose(fp); } } - if (argc == 1) + if (argc == 1) { if (dim) { getdim(stdin); } else { - getheader(stdin, fputs, stdout); + getheader(stdin, (gethfunc*)fputs, stdout); putchar('\n'); } - exit(0); + } + return 0; } -getdim(fp) /* get dimensions from file */ -register FILE *fp; +static void +getdim( /* get dimensions from file */ + 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 */ @@ -105,7 +121,8 @@ register FILE *fp; } -copycat() /* copy input to output */ +static void +copycat(void) /* copy input to output */ { register int c;