X-Git-Url: http://git.scottworley.com/overonion/blobdiff_plain/2061508697fa23aff04a6c3e15fd1dc9c93ce1d4..4c2e9bc99e3d371bcc04674a5015cd208d41dda3:/reverse.c?ds=sidebyside 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; }