From fce2bb5ea8b804d31c673df9a6c8200ae73ea268 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 18 Nov 2004 11:52:46 +0000 Subject: * win32/win32.[ch] (rb_w32_isatty): new function to replace MSVCRT's isatty because it never sets errno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'win32/win32.c') diff --git a/win32/win32.c b/win32/win32.c index b212d3874c..1e30ffec9b 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3424,6 +3424,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 // -- cgit v1.2.3