X-Git-Url: http://git.scottworley.com/overonion/blobdiff_plain/a99e77b43df141c988b52e663d64d40e79f11895..2377b838ff45bc3407e0c65028eac858c47c9d4e:/reverse.c?ds=sidebyside diff --git a/reverse.c b/reverse.c index 9bbf7b9..02a349f 100644 --- a/reverse.c +++ b/reverse.c @@ -2,14 +2,16 @@ #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], stdout); - return 0; }