12 |
|
|
13 |
|
#include <stdio.h> |
14 |
|
|
15 |
+ |
extern int fputs(); |
16 |
|
|
17 |
+ |
|
18 |
|
tabstr(s) /* put out line followed by tab */ |
19 |
|
register char *s; |
20 |
|
{ |
38 |
|
if (argc > 1 && !strcmp(argv[1], "-d")) { |
39 |
|
argc--; argv++; |
40 |
|
dim = 1; |
41 |
+ |
} else if (argc == 2 && !strcmp(argv[1], "-")) { |
42 |
+ |
getheader(stdin, NULL); |
43 |
+ |
copycat(); |
44 |
+ |
exit(0); |
45 |
|
} |
46 |
|
for (i = 1; i < argc; i++) { |
47 |
|
fputs(argv[i], stdout); |
53 |
|
getdim(fp); |
54 |
|
} else { |
55 |
|
tabstr(":\n"); |
56 |
< |
getheader(fp, tabstr); |
56 |
> |
getheader(fp, tabstr, NULL); |
57 |
|
putchar('\n'); |
58 |
|
} |
59 |
|
fclose(fp); |
63 |
|
if (dim) { |
64 |
|
getdim(stdin); |
65 |
|
} else { |
66 |
< |
copyheader(stdin, stdout); |
66 |
> |
getheader(stdin, fputs, stdout); |
67 |
|
putchar('\n'); |
68 |
|
} |
69 |
|
exit(0); |
102 |
|
fputs("unknown file type\n", stdout); |
103 |
|
break; |
104 |
|
} |
105 |
+ |
} |
106 |
+ |
|
107 |
+ |
|
108 |
+ |
copycat() /* copy input to output */ |
109 |
+ |
{ |
110 |
+ |
register int c; |
111 |
+ |
|
112 |
+ |
while ((c = getchar()) != EOF) |
113 |
+ |
putchar(c); |
114 |
|
} |