blob: e64885d73e607bfcbfc42fee54db229ba3feb056 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "zio.h"
int main(int argc, char *argv[])
{
while (argc > 1) {
FILE *file;
char line[1024];
size_t len;
argv++;
argc--;
if (!(file = fzopen(*argv, "r"))) {
fprintf(stderr, "%s\n", strerror(errno));
continue;
}
while ((len = fread(line, sizeof(char), sizeof (line), file))) {
size_t ret = fwrite(line, sizeof(char), len, stdout);
if ((ret != len) && ferror(stdout)) {
clearerr(stdout);
}
}
fclose(file);
}
return 0;
}
|