diff options
author | Jan Dubois <jand@activestate.com> | 2009-12-17 11:15:38 -0800 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2009-12-17 11:15:38 -0800 |
commit | 4342f4d6df6a7dfa22a470aa21e54a5622c009f3 (patch) | |
tree | 8e5d5672edc1178924ae3ed6b863b9eb888a4762 /win32/perlhost.h | |
parent | 827da6a38269ebe059fe8acab0772f00c88704bf (diff) | |
download | perl-4342f4d6df6a7dfa22a470aa21e54a5622c009f3.tar.gz |
Implement win32_isatty()
Commit 827da6a38 added a custom isatty() implementation
in win32/perlhost.h, but that code will only be used when
perl is compiled with -DPERL_IMPLICIT_SYS. This change
makes sure that the custom implementation will be used
on Windows for all choices of build options.
Diffstat (limited to 'win32/perlhost.h')
-rw-r--r-- | win32/perlhost.h | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/win32/perlhost.h b/win32/perlhost.h index 36a716a846..be7d61de02 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -1004,22 +1004,7 @@ PerlLIOIOCtl(struct IPerlLIO* piPerl, int i, unsigned int u, char *data) int PerlLIOIsatty(struct IPerlLIO* piPerl, int fd) { - /* The Microsoft isatty() function returns true for *all* - * character mode devices, including "nul". Our implementation - * should only return true if the handle has a console buffer. - */ - DWORD mode; - HANDLE fh = (HANDLE)_get_osfhandle(fd); - if (fh == (HANDLE)-1) { - /* errno is already set to EBADF */ - return 0; - } - - if (GetConsoleMode(fh, &mode)) - return 1; - - errno = ENOTTY; - return 0; + return win32_isatty(fd); } int |