diff options
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | emu/Nt/os.c | 20 | ||||
| -rw-r--r-- | include/version.h | 2 |
3 files changed, 17 insertions, 7 deletions
@@ -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)" |
