From d1a7b3c065e6f6d4839cc6107284f3e715d6f7ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20G=C3=B6hler?= Date: Wed, 17 Sep 2014 22:46:41 +0200 Subject: [PATCH] moved file handling to mdp.c completely --- mdp.c | 4 ++++ viewer.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mdp.c b/mdp.c index 9a71cd0..4e37879 100644 --- a/mdp.c +++ b/mdp.c @@ -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); } diff --git a/viewer.c b/viewer.c index 5fedbf7..a97e44d 100644 --- a/viewer.c +++ b/viewer.c @@ -81,9 +81,6 @@ int ncurses_display(deck_t *deck, int notrans, int nofade) { // set locale to display UTF-8 correctly in ncurses setlocale(LC_CTYPE, ""); - // replace stdin with current tty if markdown input was piped - freopen("/dev/tty", "rw", stdin); - // init ncurses initscr(); -- 2.20.1