From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- programs/cmd/batch.c | 18 +++++++++++++----- programs/cmd/wcmdmain.c | 6 +----- 2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 17ef569dc3f..d2ad690967d 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -664,11 +664,19 @@ RETURN_CODE WCMD_call(WCHAR *command) /* Run other program if no leading ':' */ if (*command != ':') { - WCMD_run_program(buffer, TRUE); - /* If the thing we try to run does not exist, call returns 1 */ - if (errorlevel == RETURN_CODE_CANT_LAUNCH) - errorlevel = ERROR_INVALID_FUNCTION; - return_code = errorlevel; + if (*WCMD_skip_leading_spaces(buffer) == L'\0') + /* FIXME it's incomplete as (call) should return 1, and (call ) should return 0... + * but we need to get the untouched string in command + */ + return_code = errorlevel = NO_ERROR; + else + { + WCMD_run_program(buffer, TRUE); + /* If the thing we try to run does not exist, call returns 1 */ + if (errorlevel == RETURN_CODE_CANT_LAUNCH) + errorlevel = ERROR_INVALID_FUNCTION; + return_code = errorlevel; + } } else if (context) { diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index b1d3ff81c04..53b08c0b137 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1431,12 +1431,8 @@ void WCMD_run_program (WCHAR *command, BOOL called) /* Quick way to get the filename is to extract the first argument. */ WINE_TRACE("Running '%s' (%d)\n", wine_dbgstr_w(command), called); firstParam = WCMD_parameter(command, 0, NULL, FALSE, TRUE); - if (!firstParam) return;
- if (!firstParam[0]) { - errorlevel = NO_ERROR; - return; - } + if (!firstParam[0]) return;
/* Calculate the search path and stem to search for */ if (wcspbrk(firstParam, L"/\:") == NULL) { /* No explicit path given, search path */