]>
Commit | Line | Data |
---|---|---|
1 | #include "reverse_lib.h" | |
2 | ||
3 | #include <err.h> | |
4 | #include <stdio.h> | |
5 | #include <string.h> | |
6 | #include <sysexits.h> | |
7 | ||
8 | int main(int argc, char** argv) { | |
9 | if (argc == 1 || (argc == 2 && strcmp(argv[1], "-") == 0)) { | |
10 | reverse_stream(stdin, stdout); | |
11 | } else if (argc == 2) { | |
12 | reverse_file(argv[1], stdout); | |
13 | } else { | |
14 | errx(EX_USAGE, "Usage: reverse filename"); | |
15 | } | |
16 | return 0; | |
17 | } |