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.
*/
void WCMD_type (WCHAR *args) {
RETURN_CODE WCMD_type(WCHAR *args)
{
RETURN_CODE return_code;
int argno = 0;
WCHAR *argN = args;
BOOL writeHeaders = FALSE;
if (param1[0] == 0x00) {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOARG));
return;
return errorlevel = ERROR_INVALID_FUNCTION;
}
if (param2[0] != 0x00) writeHeaders = TRUE;
/* Loop through all args */
errorlevel = NO_ERROR;
return_code = NO_ERROR;
while (argN) {
WCHAR *thisArg = WCMD_parameter (args, argno++, &argN, FALSE, FALSE);
@ -3520,7 +3521,7 @@ void WCMD_type (WCHAR *args) {
if (h == INVALID_HANDLE_VALUE) {
WCMD_print_error ();
WCMD_output_stderr(WCMD_LoadMessage(WCMD_READFAIL), thisArg);
errorlevel = ERROR_INVALID_FUNCTION;
return errorlevel = ERROR_INVALID_FUNCTION;
} else {
if (writeHeaders) {
WCMD_output_stderr(L"\n%1\n\n\n", thisArg);
@ -3533,6 +3534,7 @@ void WCMD_type (WCHAR *args) {
CloseHandle (h);
}
}
return errorlevel = return_code;
}
/****************************************************************************

View file

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

View file

@ -202,7 +202,7 @@ void WCMD_setshow_time (void);
void WCMD_shift (const WCHAR *args);
void WCMD_start (WCHAR *args);
void WCMD_title (const WCHAR *);
void WCMD_type (WCHAR *);
RETURN_CODE WCMD_type(WCHAR *);
void WCMD_verify (const WCHAR *args);
void WCMD_version (void);
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]);
break;
case WCMD_TYPE:
WCMD_type (parms_start);
return_code = WCMD_type(parms_start);
break;
case WCMD_VER:
WCMD_output_asis(L"\r\n");