cmd: Set success/failure return code for TYPE command.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2024-06-27 17:28:53 +02:00 committed by Alexandre Julliard
parent a132d9c37e
commit 0b6fc4cd1c
4 changed files with 12 additions and 10 deletions

View file

@ -3490,21 +3490,22 @@ void WCMD_title (const WCHAR *args) {
* Copy a file to standard output. * Copy a file to standard output.
*/ */
void WCMD_type (WCHAR *args) { RETURN_CODE WCMD_type(WCHAR *args)
{
RETURN_CODE return_code;
int argno = 0; int argno = 0;
WCHAR *argN = args; WCHAR *argN = args;
BOOL writeHeaders = FALSE; BOOL writeHeaders = FALSE;
if (param1[0] == 0x00) { if (param1[0] == 0x00) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG)); WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
return; return errorlevel = ERROR_INVALID_FUNCTION;
} }
if (param2[0] != 0x00) writeHeaders = TRUE; if (param2[0] != 0x00) writeHeaders = TRUE;
/* Loop through all args */ /* Loop through all args */
errorlevel = NO_ERROR; return_code = NO_ERROR;
while (argN) { while (argN) {
WCHAR *thisArg = WCMD_parameter (args, argno++, &argN, FALSE, FALSE); WCHAR *thisArg = WCMD_parameter (args, argno++, &argN, FALSE, FALSE);
@ -3520,7 +3521,7 @@ void WCMD_type (WCHAR *args) {
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error (); WCMD_print_error ();
WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), thisArg); WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), thisArg);
errorlevel = ERROR_INVALID_FUNCTION; return errorlevel = ERROR_INVALID_FUNCTION;
} else { } else {
if (writeHeaders) { if (writeHeaders) {
WCMD_output_stderr(L"\n%1\n\n\n", thisArg); WCMD_output_stderr(L"\n%1\n\n\n", thisArg);
@ -3533,6 +3534,7 @@ void WCMD_type (WCHAR *args) {
CloseHandle (h); CloseHandle (h);
} }
} }
return errorlevel = return_code;
} }
/**************************************************************************** /****************************************************************************

View file

@ -465,14 +465,14 @@ SUCCESS 666
SUCCESS 0 SUCCESS 0
FAILURE 33 FAILURE 33
--- success/failure for TYPE command --- success/failure for TYPE command
@todo_wine@FAILURE 1 FAILURE 1
SUCCESS 0 SUCCESS 0
@todo_wine@FAILURE 1 FAILURE 1
@todo_wine@a@space@ @todo_wine@a@space@
@todo_wine@b@space@ @todo_wine@b@space@
@todo_wine@FAILURE 1 @todo_wine@FAILURE 1
@todo_wine@--- @todo_wine@---
@todo_wine@FAILURE 1 FAILURE 1
--- success/failure for COPY command --- success/failure for COPY command
@todo_wine@FAILURE 1 @todo_wine@FAILURE 1
SUCCESS 0 SUCCESS 0

View file

@ -202,7 +202,7 @@ void WCMD_setshow_time (void);
void WCMD_shift (const WCHAR *args); void WCMD_shift (const WCHAR *args);
void WCMD_start (WCHAR *args); void WCMD_start (WCHAR *args);
void WCMD_title (const WCHAR *); void WCMD_title (const WCHAR *);
void WCMD_type (WCHAR *); RETURN_CODE WCMD_type(WCHAR *);
void WCMD_verify (const WCHAR *args); void WCMD_verify (const WCHAR *args);
void WCMD_version (void); void WCMD_version (void);
int WCMD_volume (BOOL set_label, const WCHAR *args); int WCMD_volume (BOOL set_label, const WCHAR *args);

View file

@ -1896,7 +1896,7 @@ static RETURN_CODE execute_single_command(const WCHAR *command)
WCMD_title(&whichcmd[count+1]); WCMD_title(&whichcmd[count+1]);
break; break;
case WCMD_TYPE: case WCMD_TYPE:
WCMD_type (parms_start); return_code = WCMD_type(parms_start);
break; break;
case WCMD_VER: case WCMD_VER:
WCMD_output_asis(L"\r\n"); WCMD_output_asis(L"\r\n");