about summary refs log tree commit diff
path: root/cat.c
diff options
context:
space:
mode:
Diffstat (limited to 'cat.c')
-rw-r--r--cat.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/cat.c b/cat.c
deleted file mode 100644
index 92a19b7..0000000
--- a/cat.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "stdio/stdio.h"
-
-int cat(char* filename) {
-  FILE *f;
-  f = fopen(filename, "r");
-  if (f == NULL) {
-    printf("Cannot open file '%s'\n", filename);
-    return 1;
-  }
-
-  char *line = NULL;
-  size_t linecap = 0;
-  ssize_t linelen;
-  while ((linelen = getline(&line, &linecap, f)) != -1) {
-    printf("%s", line);
-  }
-  free(line);
-  fclose(f);
-  return 0;
-}
-
-int main(int argc, char *argv[]) {
-  int err = 0;
-
-  if (argc > 1) {
-    for (int i = 1; i < argc; i++) {
-      cat(argv[i]);
-    }
-  } else {
-    printf("Usage: cat FILE [FILE] ...\n");
-  }
-
-  return 0;
-}