X-Git-Url: http://git.scottworley.com/overonion/blobdiff_plain/b398ee5ae7abfa019f84628204f3c1cd146ed39e..f5a8e270a98312d276e543807bfe66e534ca21aa:/reverse.c?ds=inline 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; }