[前][次][番号順一覧][スレッド一覧]

ruby-changes:17953

From: usa <ko1@a...>
Date: Mon, 29 Nov 2010 14:40:34 +0900 (JST)
Subject: [ruby-changes:17953] Ruby:r29969 (trunk): * win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the

usa	2010-11-29 14:33:15 +0900 (Mon, 29 Nov 2010)

  New Revision: 29969

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29969

  Log:
    * win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the
      fd is console or not, just like rb_w32_write_console().

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29968)
+++ ChangeLog	(revision 29969)
@@ -1,3 +1,8 @@
+Mon Nov 29 14:31:17 2010  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (rb_w32_isatty): use GetConsoleMode() to determine the
+	  fd is console or not, just like rb_w32_write_console().
+
 Mon Nov 29 14:19:40 2010  NAKAMURA Usaku  <usa@r...>
 
 	* include/ruby/win32.h (rb_w32_write_console): wrong prototype.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 29968)
+++ win32/win32.c	(revision 29969)
@@ -5576,11 +5576,13 @@
 int
 rb_w32_isatty(int fd)
 {
+    DWORD mode;
+
     // validate fd by using _get_osfhandle() because we cannot access _nhandle
     if (_get_osfhandle(fd) == -1) {
 	return 0;
     }
-    if (!(_osfile(fd) & FDEV)) {
+    if (!GetConsoleMode((HANDLE)_osfhnd(fd), &mode)) {
 	errno = ENOTTY;
 	return 0;
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]