| 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 |
+ |
#endif |
| 18 |
|
|
| 19 |
+ |
extern int fputs(); |
| 20 |
+ |
|
| 21 |
+ |
|
| 22 |
|
tabstr(s) /* put out line followed by tab */ |
| 23 |
|
register char *s; |
| 24 |
|
{ |
| 42 |
|
if (argc > 1 && !strcmp(argv[1], "-d")) { |
| 43 |
|
argc--; argv++; |
| 44 |
|
dim = 1; |
| 45 |
+ |
} else if (argc == 2 && !strcmp(argv[1], "-")) { |
| 46 |
+ |
#ifdef MSDOS |
| 47 |
+ |
setmode(fileno(stdin), O_BINARY); |
| 48 |
+ |
setmode(fileno(stdout), O_BINARY); |
| 49 |
+ |
#endif |
| 50 |
+ |
getheader(stdin, NULL); |
| 51 |
+ |
copycat(); |
| 52 |
+ |
exit(0); |
| 53 |
|
} |
| 54 |
|
for (i = 1; i < argc; i++) { |
| 55 |
|
fputs(argv[i], stdout); |
| 61 |
|
getdim(fp); |
| 62 |
|
} else { |
| 63 |
|
tabstr(":\n"); |
| 64 |
< |
getheader(fp, tabstr); |
| 64 |
> |
getheader(fp, tabstr, NULL); |
| 65 |
|
putchar('\n'); |
| 66 |
|
} |
| 67 |
|
fclose(fp); |
| 71 |
|
if (dim) { |
| 72 |
|
getdim(stdin); |
| 73 |
|
} else { |
| 74 |
< |
copyheader(stdin, stdout); |
| 74 |
> |
getheader(stdin, fputs, stdout); |
| 75 |
|
putchar('\n'); |
| 76 |
|
} |
| 77 |
|
exit(0); |
| 110 |
|
fputs("unknown file type\n", stdout); |
| 111 |
|
break; |
| 112 |
|
} |
| 113 |
+ |
} |
| 114 |
+ |
|
| 115 |
+ |
|
| 116 |
+ |
copycat() /* copy input to output */ |
| 117 |
+ |
{ |
| 118 |
+ |
register int c; |
| 119 |
+ |
|
| 120 |
+ |
while ((c = getchar()) != EOF) |
| 121 |
+ |
putchar(c); |
| 122 |
|
} |