summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--emu/Nt/os.c20
-rw-r--r--include/version.h2
3 files changed, 17 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 3bc1c90a..a324bdee 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+20080322
+ enable hoststderr, following acme-sac
20080319
ip/sntp neither read nor set the time correctly
20080311
diff --git a/emu/Nt/os.c b/emu/Nt/os.c
index e3d2c663..4e527371 100644
--- a/emu/Nt/os.c
+++ b/emu/Nt/os.c
@@ -19,6 +19,7 @@ DWORD consolestate;
static char* path;
static HANDLE kbdh = INVALID_HANDLE_VALUE;
static HANDLE conh = INVALID_HANDLE_VALUE;
+static HANDLE errh = INVALID_HANDLE_VALUE;
static int sleepers = 0;
wchar_t *widen(char *s);
@@ -359,6 +360,7 @@ termset(void)
return;
conh = GetStdHandle(STD_OUTPUT_HANDLE);
kbdh = GetStdHandle(STD_INPUT_HANDLE);
+ errh = GetStdHandle(STD_ERROR_HANDLE);
// The following will fail if kbdh not from console (e.g. a pipe)
// in which case we don't care
@@ -497,13 +499,19 @@ read(int fd, void *buf, uint n)
int
write(int fd, void *buf, uint n)
{
+ HANDLE h;
+
if(fd == 1 || fd == 2){
- if(conh == INVALID_HANDLE_VALUE){
- termset();
- if(conh == INVALID_HANDLE_VALUE)
- return -1;
- }
- if(!WriteFile(conh, buf, n, &n, NULL))
+ if(fd == 1){
+ if(conh == INVALID_HANDLE_VALUE){
+ termset();
+ }
+ h = conh;
+ }else
+ h = errh;
+ if(h == INVALID_HANDLE_VALUE)
+ return -1;
+ if(!WriteFile(h, buf, n, &n, NULL))
return -1;
return n;
}
diff --git a/include/version.h b/include/version.h
index b394c298..6b1b0c9a 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20080319)"
+#define VERSION "Fourth Edition (20080321)"