X-Git-Url: http://git.scottworley.com/overonion/blobdiff_plain/b398ee5ae7abfa019f84628204f3c1cd146ed39e..4a5d2fe40628c9348fe018e0ee69aba6787905cf:/reverse.c diff --git a/reverse.c b/reverse.c index 2d83751..02a349f 100644 --- a/reverse.c +++ b/reverse.c @@ -1,14 +1,17 @@ #include "reverse_lib.h" #include +#include +#include #include int main(int argc, char** argv) { - if (argc != 2) { + if (argc == 1 || (argc == 2 && strcmp(argv[1], "-") == 0)) { + reverse_stream(stdin, stdout); + } else if (argc == 2) { + reverse_file(argv[1], stdout); + } else { errx(EX_USAGE, "Usage: reverse filename"); } - - reverse_file(argv[1]); - return 0; }