X-Git-Url: http://git.scottworley.com/overonion/blobdiff_plain/2061508697fa23aff04a6c3e15fd1dc9c93ce1d4..622af8d7465b204a817a06a4962e5aaee69c4954:/reverse.c?ds=inline diff --git a/reverse.c b/reverse.c index a933907..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], 1); - return 0; }