From 7a8e3c759e01b6c6db159475fcaeb21b8fc2442d Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Sat, 30 Aug 2014 00:28:41 -0500 Subject: [PATCH] Never close stdin; allow multiple `-` arguments --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 12dcd70..335ca7b 100644 --- a/main.c +++ b/main.c @@ -151,7 +151,11 @@ int next_input_idx; static int read_more(char* buf, size_t size, int* islast) { while (!current_input || feof(current_input)) { if (current_input) { - fclose(current_input); + if (current_input == stdin) { + clearerr(stdin); // perhaps we can read again + } else { + fclose(current_input); + } current_input = 0; } if (next_input_idx == ninput_files) { -- 2.40.0