| 1 | – | /* Copyright (c) 1992 Regents of the University of California */ | 
| 2 | – |  | 
| 1 |  | #ifndef lint | 
| 2 | < | static char SCCSid[] = "$SunId$ LBL"; | 
| 2 | > | static const char       RCSid[] = "$Id$"; | 
| 3 |  | #endif | 
| 6 | – |  | 
| 4 |  | /* | 
| 5 |  | *  getinfo.c - program to read info. header from file. | 
| 6 |  | * | 
| 8 |  | */ | 
| 9 |  |  | 
| 10 |  | #include  <stdio.h> | 
| 11 | + | #include  <string.h> | 
| 12 |  |  | 
| 13 | < | #ifdef MSDOS | 
| 14 | < | #include <fcntl.h> | 
| 17 | < | extern int  _fmode; | 
| 18 | < | #endif | 
| 13 | > | #include  "platform.h" | 
| 14 | > | #include  "resolu.h" | 
| 15 |  |  | 
| 16 | < | extern int  fputs(); | 
| 16 | > | static gethfunc tabstr; | 
| 17 | > | static void getdim(register FILE *fp); | 
| 18 | > | static void copycat(void); | 
| 19 |  |  | 
| 20 |  |  | 
| 21 | < | tabstr(s)                               /* put out line followed by tab */ | 
| 22 | < | register char  *s; | 
| 21 | > | static int | 
| 22 | > | tabstr(                         /* put out line followed by tab */ | 
| 23 | > | register char  *s, | 
| 24 | > | void *p | 
| 25 | > | ) | 
| 26 |  | { | 
| 27 |  | while (*s) { | 
| 28 |  | putchar(*s); | 
| 30 |  | } | 
| 31 |  | if (*--s == '\n') | 
| 32 |  | putchar('\t'); | 
| 33 | + | return(0); | 
| 34 |  | } | 
| 35 |  |  | 
| 36 |  |  | 
| 37 | < | main(argc, argv) | 
| 38 | < | int  argc; | 
| 39 | < | char  **argv; | 
| 37 | > | int | 
| 38 | > | main( | 
| 39 | > | int  argc, | 
| 40 | > | char  **argv | 
| 41 | > | ) | 
| 42 |  | { | 
| 43 |  | int  dim = 0; | 
| 44 |  | FILE  *fp; | 
| 47 |  | if (argc > 1 && !strcmp(argv[1], "-d")) { | 
| 48 |  | argc--; argv++; | 
| 49 |  | dim = 1; | 
| 50 | < | #ifdef MSDOS | 
| 51 | < | setmode(fileno(stdin), _fmode = O_BINARY); | 
| 48 | < | #endif | 
| 50 | > | SET_DEFAULT_BINARY(); /* for output file */ | 
| 51 | > | SET_FILE_BINARY(stdin); | 
| 52 |  | } else if (argc == 2 && !strcmp(argv[1], "-")) { | 
| 53 | < | #ifdef MSDOS | 
| 54 | < | setmode(fileno(stdin), O_BINARY); | 
| 52 | < | setmode(fileno(stdout), O_BINARY); | 
| 53 | < | #endif | 
| 53 | > | SET_FILE_BINARY(stdin); | 
| 54 | > | SET_FILE_BINARY(stdout); | 
| 55 |  | getheader(stdin, NULL, NULL); | 
| 56 |  | copycat(); | 
| 57 | < | exit(0); | 
| 57 | > | return 0; | 
| 58 |  | } | 
| 59 |  | for (i = 1; i < argc; i++) { | 
| 60 |  | fputs(argv[i], stdout); | 
| 65 |  | fputs(": ", stdout); | 
| 66 |  | getdim(fp); | 
| 67 |  | } else { | 
| 68 | < | tabstr(":\n"); | 
| 68 | > | tabstr(":\n", NULL); | 
| 69 |  | getheader(fp, tabstr, NULL); | 
| 70 |  | putchar('\n'); | 
| 71 |  | } | 
| 72 |  | fclose(fp); | 
| 73 |  | } | 
| 74 |  | } | 
| 75 | < | if (argc == 1) | 
| 75 | > | if (argc == 1) { | 
| 76 |  | if (dim) { | 
| 77 |  | getdim(stdin); | 
| 78 |  | } else { | 
| 79 | < | getheader(stdin, fputs, stdout); | 
| 79 | > | getheader(stdin, (gethfunc*)fputs, stdout); | 
| 80 |  | putchar('\n'); | 
| 81 |  | } | 
| 82 | < | exit(0); | 
| 82 | > | } | 
| 83 | > | return 0; | 
| 84 |  | } | 
| 85 |  |  | 
| 86 |  |  | 
| 87 | < | getdim(fp)                              /* get dimensions from file */ | 
| 88 | < | register FILE  *fp; | 
| 87 | > | static void | 
| 88 | > | getdim(                         /* get dimensions from file */ | 
| 89 | > | register FILE  *fp | 
| 90 | > | ) | 
| 91 |  | { | 
| 92 |  | int  j; | 
| 93 |  | register int  c; | 
| 121 |  | } | 
| 122 |  |  | 
| 123 |  |  | 
| 124 | < | copycat()                       /* copy input to output */ | 
| 124 | > | static void | 
| 125 | > | copycat(void)                   /* copy input to output */ | 
| 126 |  | { | 
| 127 |  | register int    c; | 
| 128 |  |  |