remove duplicated code
[smdp.git] / mdp.c
diff --git a/mdp.c b/mdp.c
index d641faa..4e37879 100644 (file)
--- a/mdp.c
+++ b/mdp.c
@@ -1,5 +1,5 @@
 /*
- * mpd -- A command-line based markdown presentation tool.
+ * mdp -- A command-line based markdown presentation tool.
  * Copyright (C) 2014 Michael Goehler
  *
  * This program is free software: you can redistribute it and/or modify
@@ -104,6 +104,10 @@ int main(int argc, char *argv[]) {
     // close file
     fclose(input);
 
+    // replace stdin with current tty if input was a pipe
+    if(input == stdin)
+        freopen("/dev/tty", "rw", stdin);
+
     if(debug > 0) {
         markdown_debug(deck, debug);
     }