summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 08:05:10 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 08:05:10 +0000
commit8dac052af443ca14fac6d343b22113fb1d19cd1b (patch)
tree619c88c1d02f29641f374d2ec45b75a0e43a2503 /win32/win32.c
parentdb82a3315ba7ca71d41ee108f865f9e43443eb18 (diff)
* win32/win32.[ch] (rb_w32_isatty): new function to replace MSVCRT's
isatty because it never sets errno. (backported from CVS HEAD) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index a4cea9b287..f44b805ae6 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3322,6 +3322,20 @@ rb_w32_snprintf(char *buf, size_t size, const char *format, ...)
return ret;
}
+int
+rb_w32_isatty(int fd)
+{
+ if (!(_osfile(fd) & FOPEN)) {
+ errno = EBADF;
+ return 0;
+ }
+ if (!(_osfile(fd) & FDEV)) {
+ errno = ENOTTY;
+ return 0;
+ }
+ return 1;
+}
+
//
// Fix bcc32's stdio bug
//