From a2a51b77a5534978f30f2788f7ed9cbe4fda3089 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 14 Sep 2020 20:48:50 +0200 Subject: Removing path hash table, replacing it by brute force search --- src/eval/cmd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/eval/cmd.c') diff --git a/src/eval/cmd.c b/src/eval/cmd.c index 455ff77..8e6e72a 100644 --- a/src/eval/cmd.c +++ b/src/eval/cmd.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/14 10:41:31 by charles #+# #+# */ -/* Updated: 2020/09/14 17:18:05 by charles ### ########.fr */ +/* Updated: 2020/09/14 21:32:19 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -36,7 +36,7 @@ int wrapped_cmd(void *void_param) } } -int eval_cmd(int fds[2], t_env env, t_path path, t_ast *ast, pid_t *child_pid) +int eval_cmd(int fds[2], t_env env, t_ast *ast, pid_t *child_pid) { t_fork_param_cmd param; char **argv; @@ -54,13 +54,13 @@ int eval_cmd(int fds[2], t_env env, t_path path, t_ast *ast, pid_t *child_pid) if (param.builtin == NULL) { - status = exec_search_path(path, env_search(env, "PATH"), argv[0], ¶m.exec_path); - if (status != 0) + + if (!path_search(env, argv[0], param.exec_path)) { - if (status == 127) - errorf("%s: command not found\n", argv[0]); + /* printf("--------%s---\n", env_search(env, "PATH")); */ + errorf("%s: command not found\n", argv[0]); ft_split_destroy(argv); - return (status); + return (127); } if ((status = exec_path_check(param.exec_path)) != 0) return (status); -- cgit