summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-10 03:06:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-02-10 03:06:43 +0000
commit6400a671b8775096f3c312cf04e413c3307b2edb (patch)
tree1b66b4ef72163534e59f610db8c941ac5d0c03e2 /win32
parent8c5bd041b6ddca4a6b403624bedc5554f3474cbd (diff)
* 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
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 9de71d7a25..92d00166bd 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -409,6 +409,8 @@ static void init_env(void)
NTLoginName[len] = '\0';
}
+static void init_stdhandle();
+
//
// Initialization stuff
//
@@ -431,6 +433,8 @@ NtInitialize(int *argc, char ***argv)
init_env();
+ init_stdhandle();
+
// Initialize Winsock
StartSockets();
}
@@ -1647,11 +1651,29 @@ rb_w32_open_osfhandle(long osfhandle, int flags)
}
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
#define _set_osfhnd(fh, osfh) (void)((fh), (osfh))
#define _set_osflags(fh, flags) (void)((fh), (flags))
+static void
+init_stdhandle()
+{
+}
#endif
#ifdef __BORLANDC__