19 |
|
#define MAXLINE 512 /* maximum input line */ |
20 |
|
|
21 |
|
FILE *input[MAXFILE]; |
22 |
< |
int tabc[MAXFILE]; |
22 |
> |
char *tabc[MAXFILE]; |
23 |
|
int nfiles; |
24 |
|
|
25 |
|
char buf[MAXLINE]; |
30 |
|
char *argv[]; |
31 |
|
{ |
32 |
|
register int i; |
33 |
< |
int curtab; |
33 |
> |
char *curtab; |
34 |
|
int running; |
35 |
|
|
36 |
< |
curtab = '\t'; |
36 |
> |
curtab = "\t"; |
37 |
|
nfiles = 0; |
38 |
|
for (i = 1; i < argc; i++) { |
39 |
|
if (argv[i][0] == '-') { |
40 |
|
switch (argv[i][1]) { |
41 |
|
case 't': |
42 |
< |
curtab = argv[i][2]; |
42 |
> |
curtab = argv[i]+2; |
43 |
|
break; |
44 |
|
case '\0': |
45 |
|
tabc[nfiles] = curtab; |
77 |
|
for (i = 0; i < nfiles; i++) { |
78 |
|
if (fgets(buf, MAXLINE, input[i]) != NULL) { |
79 |
|
if (i) |
80 |
< |
putchar(tabc[i]); |
80 |
> |
fputs(tabc[i], stdout); |
81 |
|
buf[strlen(buf)-1] = '\0'; |
82 |
|
fputs(buf, stdout); |
83 |
|
running++; |