summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn van Groningen2004-06-25 10:41:35 +0000
committerJohn van Groningen2004-06-25 10:41:35 +0000
commiteb60a204c1b325838b740ecb623922c30b558d60 (patch)
treeb8b0b83d314485860a869bb763881586259e6a94
parentdetect EOF in file_read_string and file_read_line for redirected files and (diff)
implement file_error for stdio
-rw-r--r--ufileIO2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ufileIO2.c b/ufileIO2.c
index f079f70..f718b3b 100644
--- a/ufileIO2.c
+++ b/ufileIO2.c
@@ -940,8 +940,12 @@ int file_error (long fn)
{
if (fn<FIRST_REAL_FILE){
switch (fn){
- case 0:
case 1:
+ if (ferror (stdin) || ferror (stdout))
+ return -1;
+ else
+ return 0;
+ case 0:
return 0;
default:
return -1;