=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: cmd: Add WCMD_output_stderr function to output error messages to stderr.

Alexandre Julliard julliard at winehq.org
Mon Sep 26 16:15:13 CDT 2011


Module: wine
Branch: master
Commit: fbddecab774e8cc6c07b292b4b1034f55e4c95ea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fbddecab774e8cc6c07b292b4b1034f55e4c95ea

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Sat Sep 24 12:50:55 2011 +0200

cmd: Add WCMD_output_stderr function to output error messages to stderr.

---

 programs/cmd/wcmd.h     |    1 +
 programs/cmd/wcmdmain.c |   23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index 940cb6e..d370764 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -73,6 +73,7 @@ void WCMD_leave_paged_mode(void);
 void WCMD_more (WCHAR *);
 void WCMD_move (void);
 void WCMD_output (const WCHAR *format, ...);
+void WCMD_output_stderr (const WCHAR *format, ...);
 void WCMD_output_asis (const WCHAR *message);
 void WCMD_output_asis_stderr (const WCHAR *message);
 void WCMD_pause (void);
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index b254728..8e222a3 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -174,7 +174,7 @@ void WCMD_output (const WCHAR *format, ...) {
   va_start(ap,format);
   ret = vsnprintfW(string, sizeof(string)/sizeof(WCHAR), format, ap);
   if( ret >= (sizeof(string)/sizeof(WCHAR))) {
-       WINE_ERR("Output truncated in WCMD_output\n" );
+       WINE_ERR("Output truncated\n" );
        ret = (sizeof(string)/sizeof(WCHAR)) - 1;
        string[ret] = '\0';
   }
@@ -182,6 +182,27 @@ void WCMD_output (const WCHAR *format, ...) {
   WCMD_output_asis_len(string, ret, GetStdHandle(STD_OUTPUT_HANDLE));
 }
 
+/*******************************************************************
+ * WCMD_output_stderr - send output to current standard error device.
+ *
+ */
+
+void WCMD_output_stderr (const WCHAR *format, ...) {
+
+  va_list ap;
+  WCHAR string[1024];
+  int ret;
+
+  va_start(ap,format);
+  ret = vsnprintfW(string, sizeof(string)/sizeof(WCHAR), format, ap);
+  if( ret >= (sizeof(string)/sizeof(WCHAR))) {
+       WINE_ERR("Output truncated\n" );
+       ret = (sizeof(string)/sizeof(WCHAR)) - 1;
+       string[ret] = '\0';
+  }
+  va_end(ap);
+  WCMD_output_asis_len(string, ret, GetStdHandle(STD_ERROR_HANDLE));
+}
 
 static int line_count;
 static int max_height;




More information about the wine-cvs mailing list