| 1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 12 |
|
|
| 13 |
|
#include <stdio.h> |
| 14 |
|
|
| 15 |
+ |
#ifdef MSDOS |
| 16 |
+ |
#include <fcntl.h> |
| 17 |
+ |
extern int _fmode; |
| 18 |
+ |
#endif |
| 19 |
|
|
| 20 |
+ |
extern int fputs(); |
| 21 |
+ |
|
| 22 |
+ |
|
| 23 |
|
tabstr(s) /* put out line followed by tab */ |
| 24 |
|
register char *s; |
| 25 |
|
{ |
| 34 |
|
|
| 35 |
|
main(argc, argv) |
| 36 |
|
int argc; |
| 37 |
< |
char *argv[]; |
| 37 |
> |
char **argv; |
| 38 |
|
{ |
| 39 |
|
int dim = 0; |
| 40 |
|
FILE *fp; |
| 43 |
|
if (argc > 1 && !strcmp(argv[1], "-d")) { |
| 44 |
|
argc--; argv++; |
| 45 |
|
dim = 1; |
| 46 |
+ |
#ifdef MSDOS |
| 47 |
+ |
setmode(fileno(stdin), _fmode = O_BINARY); |
| 48 |
+ |
#endif |
| 49 |
+ |
} else if (argc == 2 && !strcmp(argv[1], "-")) { |
| 50 |
+ |
#ifdef MSDOS |
| 51 |
+ |
setmode(fileno(stdin), O_BINARY); |
| 52 |
+ |
setmode(fileno(stdout), O_BINARY); |
| 53 |
+ |
#endif |
| 54 |
+ |
getheader(stdin, NULL, NULL); |
| 55 |
+ |
copycat(); |
| 56 |
+ |
exit(0); |
| 57 |
|
} |
| 58 |
|
for (i = 1; i < argc; i++) { |
| 59 |
|
fputs(argv[i], stdout); |
| 65 |
|
getdim(fp); |
| 66 |
|
} else { |
| 67 |
|
tabstr(":\n"); |
| 68 |
< |
getheader(fp, tabstr); |
| 68 |
> |
getheader(fp, tabstr, NULL); |
| 69 |
|
putchar('\n'); |
| 70 |
|
} |
| 71 |
|
fclose(fp); |
| 75 |
|
if (dim) { |
| 76 |
|
getdim(stdin); |
| 77 |
|
} else { |
| 78 |
< |
copyheader(stdin, stdout); |
| 78 |
> |
getheader(stdin, fputs, stdout); |
| 79 |
|
putchar('\n'); |
| 80 |
|
} |
| 81 |
|
exit(0); |
| 88 |
|
int j; |
| 89 |
|
register int c; |
| 90 |
|
|
| 91 |
< |
getheader(fp, NULL); /* skip header */ |
| 91 |
> |
getheader(fp, NULL, NULL); /* skip header */ |
| 92 |
|
|
| 93 |
|
switch (c = getc(fp)) { |
| 94 |
|
case '+': /* picture */ |
| 114 |
|
fputs("unknown file type\n", stdout); |
| 115 |
|
break; |
| 116 |
|
} |
| 117 |
+ |
} |
| 118 |
+ |
|
| 119 |
+ |
|
| 120 |
+ |
copycat() /* copy input to output */ |
| 121 |
+ |
{ |
| 122 |
+ |
register int c; |
| 123 |
+ |
|
| 124 |
+ |
while ((c = getchar()) != EOF) |
| 125 |
+ |
putchar(c); |
| 126 |
|
} |