From 4a12783e07fdd246773d73337c831f4b97e31a3b Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Thu, 23 Mar 2006 15:40:08 +0000 Subject: detect redirection of stdio to or from a pipe --- wcon.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'wcon.c') diff --git a/wcon.c b/wcon.c index bce94c2..20f9bb1 100644 --- a/wcon.c +++ b/wcon.c @@ -1326,8 +1326,15 @@ int clean_main (void) else std_error_handle=GetStdHandle (STD_ERROR_HANDLE); - std_input_from_file = GetFileType (std_input_handle)==FILE_TYPE_DISK; - std_output_to_file = GetFileType (std_output_handle)==FILE_TYPE_DISK; + { + int std_input_file_type,std_output_file_type; + + std_input_file_type=GetFileType (std_input_handle); + std_input_from_file=std_input_file_type==FILE_TYPE_DISK || std_input_file_type==FILE_TYPE_PIPE; + + std_output_file_type=GetFileType (std_output_handle); + std_output_to_file=std_output_file_type==FILE_TYPE_DISK || std_output_file_type==FILE_TYPE_PIPE; + } if (std_input_from_file || std_output_to_file) init_std_io_from_or_to_file(); -- cgit v1.2.3