]> git.scottworley.com Git - overonion/blobdiff - reverse.c
Add hashing
[overonion] / reverse.c
index 9bbf7b93076e4a61870f3f01c2e2010ed8ada58e..02a349fc33009860caa43dea115fbc27fdc86b19 100644 (file)
--- a/reverse.c
+++ b/reverse.c
@@ -2,14 +2,16 @@
 
 #include <err.h>
 #include <stdio.h>
+#include <string.h>
 #include <sysexits.h>
 
 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;
 }