summaryrefslogtreecommitdiff
path: root/tac.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-07-19 13:47:40 -0400
committerJakob Kaivo <jkk@ung.org>2019-07-19 13:47:40 -0400
commit512def0747a237976b045175d271d41280de8b15 (patch)
tree7831251ada4b6da1e14e7050a8cb0a8d5f5d01e2 /tac.c
parentfdf655797bbff965d93beb7e51c025eb3fc20526 (diff)
on second thought, an AWK script is fine
Diffstat (limited to 'tac.c')
-rw-r--r--tac.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/tac.c b/tac.c
deleted file mode 100644
index 088ebda..0000000
--- a/tac.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-struct line {
- struct line *prev;
- struct line *next;
- char *line;
-};
-
-int tac(const char *path)
-{
- FILE *f = stdin;
- if (path && strcmp(path, "-") != 0) {
- f = fopen(path, "r");
- if (f == NULL) {
- perror("tac:fopen");
- }
- }
-
- /* read lines into doubly-linked list */
- /* print lines in reverse order */
-
- if (f != stdin) {
- fclose(f);
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- while (getopt(argc, argv, "") != -1) {
- /* no options supported */
- return 1;
- }
-
- int ret = 0;
- do {
- ret |= tac(argv[optind]);
- } while (argv[++optind]);
- return 1;
-}