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