From: Santino Mazza <smazza@codeweavers.com> --- programs/cmd/wcmd.h | 11 +++++++++++ programs/cmd/wcmdmain.c | 19 +++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index c8d0d03e9e6..dd912ea33c7 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -233,6 +233,17 @@ enum read_parse_line WCMD_ReadAndParseLine(CMD_NODE **output); void node_dispose_tree(CMD_NODE *cmds); RETURN_CODE node_execute(CMD_NODE *node); +struct search_command +{ + WCHAR path[MAX_PATH]; + BOOL has_path; /* if input has path part (ie cannot be a builtin command) */ + BOOL has_extension; /* if extension was given to input */ + BOOL is_command_file; /* when has_path is set, tells whether its a command file, or an external executable */ + int cmd_index; /* potential index to builtin command */ +}; + +RETURN_CODE WCMD_search_command(WCHAR *command, struct search_command *sc, BOOL fast); + RETURN_CODE WCMD_call_batch(const WCHAR *, WCHAR *); RETURN_CODE WCMD_call_command(WCHAR *command); RETURN_CODE WCMD_run_builtin_command(int cmd_index, WCHAR *cmd); diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 511d181c117..7f47a69b57c 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1885,15 +1885,6 @@ static RETURN_CODE run_command_file(const WCHAR *file, WCHAR *full_cmdline) return return_code; } -struct search_command -{ - WCHAR path[MAX_PATH]; - BOOL has_path; /* if input has path part (ie cannot be a builtin command) */ - BOOL has_extension; /* if extension was given to input */ - BOOL is_command_file; /* when has_path is set, tells whether its a command file, or an external executable */ - int cmd_index; /* potential index to builtin command */ -}; - static BOOL search_in_pathext(WCHAR *path) { static struct @@ -1972,7 +1963,7 @@ static BOOL search_in_pathext(WCHAR *path) return TRUE; } -static RETURN_CODE search_command(WCHAR *command, struct search_command *sc, BOOL fast) +RETURN_CODE WCMD_search_command(WCHAR *command, struct search_command *sc, BOOL fast) { WCHAR temp[MAX_PATH]; WCHAR pathtosearch[MAXSTRING]; @@ -2407,7 +2398,7 @@ static RETURN_CODE execute_single_command(const WCHAR *command) TRACE("Command: '%s'\n", wine_dbgstr_w(cmd)); - return_code = search_command(cmd, &sc, TRUE); + return_code = WCMD_search_command(cmd, &sc, TRUE); if (return_code != NO_ERROR && sc.cmd_index == WCMD_EXIT + 1) { /* Not found anywhere - give up */ @@ -2459,7 +2450,7 @@ RETURN_CODE WCMD_call_command(WCHAR *command) struct search_command sc; RETURN_CODE return_code; - return_code = search_command(command, &sc, FALSE); + return_code = WCMD_search_command(command, &sc, FALSE); if (return_code == NO_ERROR) { if (!*sc.path) return NO_ERROR; @@ -4519,7 +4510,7 @@ static RETURN_CODE spawn_pipe_sub_command(CMD_NODE *node, HANDLE *child) struct search_command sc; /* command isn't delayed expanded... */ - return_code = search_command(node->command, &sc, TRUE); + return_code = WCMD_search_command(node->command, &sc, TRUE); if (return_code != NO_ERROR && sc.cmd_index == WCMD_EXIT + 1) return RETURN_CODE_CANT_LAUNCH; if ((sc.cmd_index <= WCMD_EXIT && (return_code != NO_ERROR || (!sc.has_path && !sc.has_extension))) || @@ -4902,7 +4893,7 @@ static void parse_command_line_parameters(struct cmd_parameters *parameters) { struct search_command sc; - if (search_command(parameters->initial_command, &sc, TRUE) != NO_ERROR) /* no command found */ + if (WCMD_search_command(parameters->initial_command, &sc, TRUE) != NO_ERROR) /* no command found */ { WINE_TRACE("Binary not found, dropping back to old behaviour\n"); opt_s = TRUE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11608