summaryrefslogtreecommitdiff
path: root/testt.c
diff options
context:
space:
mode:
Diffstat (limited to 'testt.c')
-rw-r--r--testt.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/testt.c b/testt.c
new file mode 100644
index 0000000..e64885d
--- /dev/null
+++ b/testt.c
@@ -0,0 +1,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;
+}