diff options
author | Christopher Faylor <me@cgf.cx> | 2001-08-22 17:50:22 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-08-22 17:50:22 +0000 |
commit | 0a047e8f321216f24140ee18135bbe9ea4461f0a (patch) | |
tree | e8bc85a9d7a597f57dccb8ec64e0ff8a479c2249 /winsup/cygwin/smallprint.c | |
parent | 1fdc8df95d7723d278daf4c3ce2f856d8d1db276 (diff) | |
download | newlib-0a047e8f321216f24140ee18135bbe9ea4461f0a.zip newlib-0a047e8f321216f24140ee18135bbe9ea4461f0a.tar.gz newlib-0a047e8f321216f24140ee18135bbe9ea4461f0a.tar.bz2 |
* smallprint.c (console_printf): New function.
* dcrt0.cc (dll_crt0_1): Use console_printf for debugging output.
* debug.cc (debug_mark_closed): New function.
(close_handle): Use debug_mark_closed.
* debug.h: Declare new functions.
* dtable.cc (dtable::build_fhandler): Remove unneeded extern.
* spawn.cc: Cosmetic changes.
* winsup.h: Define NO_COPY for C files, too. Declare a global.
Diffstat (limited to 'winsup/cygwin/smallprint.c')
-rw-r--r-- | winsup/cygwin/smallprint.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c index 54ae9b0..7e23d1a 100644 --- a/winsup/cygwin/smallprint.c +++ b/winsup/cygwin/smallprint.c @@ -181,7 +181,7 @@ __small_sprintf (char *dst, const char *fmt,...) void small_printf (const char *fmt,...) { - char buf[2000]; + char buf[16384]; va_list ap; DWORD done; int count; @@ -199,6 +199,29 @@ small_printf (const char *fmt,...) count = __small_vsprintf (buf, fmt, ap); va_end (ap); - WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, 0); + WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, NULL); FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE)); } + +#ifdef DEBUGGING +static HANDLE NO_COPY console_handle = NULL; +void +console_printf (const char *fmt,...) +{ + char buf[16384]; + va_list ap; + DWORD done; + int count; + extern SECURITY_ATTRIBUTES sec_none; + + if (!console_handle) + console_handle = CreateFileA ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, + &sec_none, OPEN_EXISTING, 0, 0); + va_start (ap, fmt); + count = __small_vsprintf (buf, fmt, ap); + va_end (ap); + + WriteFile (console_handle, buf, count, &done, NULL); + FlushFileBuffers (console_handle); +} +#endif |