* win32/win32.c (init_stdhandle): assign standard file handles.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-02-10 03:06:43 +00:00
parent 8c5bd041b6
commit 6400a671b8
2 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Thu Feb 10 12:06:31 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (init_stdhandle): assign standard file handles.
Wed Feb 9 16:33:05 2005 NAKAMURA Usaku <usa@ruby-lang.org> Wed Feb 9 16:33:05 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/socket.c (wait_connectable): fixed wrong condition. * ext/socket/socket.c (wait_connectable): fixed wrong condition.

View File

@ -409,6 +409,8 @@ static void init_env(void)
NTLoginName[len] = '\0'; NTLoginName[len] = '\0';
} }
static void init_stdhandle();
// //
// Initialization stuff // Initialization stuff
// //
@ -431,6 +433,8 @@ NtInitialize(int *argc, char ***argv)
init_env(); init_env();
init_stdhandle();
// Initialize Winsock // Initialize Winsock
StartSockets(); StartSockets();
} }
@ -1647,11 +1651,29 @@ rb_w32_open_osfhandle(long osfhandle, int flags)
} }
return fh; /* return handle */ return fh; /* return handle */
} }
static void
init_stdhandle()
{
if (fileno(stdin) < 0) {
stdin->_file = 0;
}
if (fileno(stdout) < 0) {
stdout->_file = 1;
}
if (fileno(stderr) < 0) {
stderr->_file = 2;
}
}
#else #else
#define _set_osfhnd(fh, osfh) (void)((fh), (osfh)) #define _set_osfhnd(fh, osfh) (void)((fh), (osfh))
#define _set_osflags(fh, flags) (void)((fh), (flags)) #define _set_osflags(fh, flags) (void)((fh), (flags))
static void
init_stdhandle()
{
}
#endif #endif
#ifdef __BORLANDC__ #ifdef __BORLANDC__