cmd: Print error messages on stderr, not on stdout.

This commit is contained in:
Francois Gouget 2011-12-02 10:07:27 +01:00 committed by Alexandre Julliard
parent 4b79809844
commit bc176ecb81
3 changed files with 13 additions and 15 deletions

View file

@ -194,7 +194,7 @@ void WCMD_clear_screen (void) {
void WCMD_change_tty (void) { void WCMD_change_tty (void) {
WCMD_output (WCMD_LoadMessage(WCMD_NYI)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_NYI));
} }
@ -390,7 +390,7 @@ void WCMD_copy (void) {
WCHAR ext[MAX_PATH]; WCHAR ext[MAX_PATH];
if (param1[0] == 0x00) { if (param1[0] == 0x00) {
WCMD_output (WCMD_LoadMessage(WCMD_NOARG)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_NOARG));
return; return;
} }
@ -1135,7 +1135,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Ensure line continues with variable */ /* Ensure line continues with variable */
if (!*curPos || *curPos != '%') { if (!*curPos || *curPos != '%') {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_SYNTAXERR));
return; return;
} }
@ -1154,7 +1154,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
if (!*curPos if (!*curPos
|| !WCMD_keyword_ws_found(inW, sizeof(inW)/sizeof(inW[0]), curPos)) { || !WCMD_keyword_ws_found(inW, sizeof(inW)/sizeof(inW[0]), curPos)) {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_SYNTAXERR));
return; return;
} }
@ -1181,7 +1181,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
if ((*cmdList == NULL) if ((*cmdList == NULL)
|| !WCMD_keyword_ws_found(doW, sizeof(doW)/sizeof(doW[0]), (*cmdList)->command)) { || !WCMD_keyword_ws_found(doW, sizeof(doW)/sizeof(doW[0]), (*cmdList)->command)) {
WCMD_output (WCMD_LoadMessage(WCMD_SYNTAXERR)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_SYNTAXERR));
return; return;
} }
@ -2199,14 +2199,14 @@ void WCMD_setshow_date (void) {
WCMD_output (WCMD_LoadMessage(WCMD_NEWDATE)); WCMD_output (WCMD_LoadMessage(WCMD_NEWDATE));
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count); WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count);
if (count > 2) { if (count > 2) {
WCMD_output (WCMD_LoadMessage(WCMD_NYI)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_NYI));
} }
} }
} }
else WCMD_print_error (); else WCMD_print_error ();
} }
else { else {
WCMD_output (WCMD_LoadMessage(WCMD_NYI)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_NYI));
} }
} }
@ -2427,14 +2427,14 @@ void WCMD_setshow_time (void) {
WCMD_output (WCMD_LoadMessage(WCMD_NEWTIME)); WCMD_output (WCMD_LoadMessage(WCMD_NEWTIME));
WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count); WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer)/sizeof(WCHAR), &count);
if (count > 2) { if (count > 2) {
WCMD_output (WCMD_LoadMessage(WCMD_NYI)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_NYI));
} }
} }
} }
else WCMD_print_error (); else WCMD_print_error ();
} }
else { else {
WCMD_output (WCMD_LoadMessage(WCMD_NYI)); WCMD_output_stderr (WCMD_LoadMessage(WCMD_NYI));
} }
} }
@ -2515,7 +2515,7 @@ void WCMD_type (WCHAR *command) {
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error (); WCMD_print_error ();
WCMD_output(WCMD_LoadMessage(WCMD_READFAIL), thisArg); /* should be _stderr */ WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), thisArg);
errorlevel = 1; errorlevel = 1;
} else { } else {
if (writeHeaders) { if (writeHeaders) {

View file

@ -141,7 +141,6 @@ if 1==1 (echo foo2>bar) else echo baz2>bar
type bar & del bar type bar & del bar
if 1==1 (echo foo3) else echo baz3>bar if 1==1 (echo foo3) else echo baz3>bar
type bar || echo file does not exist, ok type bar || echo file does not exist, ok
echo -----
if 1==1 (echo foo4>bar) else echo baz4>bar if 1==1 (echo foo4>bar) else echo baz4>bar
type bar & del bar type bar & del bar
if 1==0 (echo foo5>bar) else echo baz5>bar if 1==0 (echo foo5>bar) else echo baz5>bar

View file

@ -166,8 +166,7 @@ food21
----- -----
foo2 foo2
foo3 foo3
@todo_wine@file does not exist, ok file does not exist, ok
@todo_wine@-----
foo4 foo4
baz5 baz5
baz6@space@ baz6@space@
@ -190,8 +189,8 @@ baz
@todo_wine@foo | echo bar @todo_wine@foo | echo bar
@todo_wine@foo & echo bar @todo_wine@foo & echo bar
@todo_wine@bak & @todo_wine@bak &
@todo_wine@baz@space@ baz@space@
@todo_wine@0@or_broken@1 0@or_broken@1
@todo_wine@foo > foo @todo_wine@foo > foo
@todo_wine@< @todo_wine@<
@todo_wine@ffoof @todo_wine@ffoof