From 8e40323db9715621d8ab45ff6d943c2eeba46ea0 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 --- include/eval.h | 14 ++++++-------- include/minishell.h | 5 ++--- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/eval.h b/include/eval.h index 6aaefd9..02d0624 100644 --- a/include/eval.h +++ b/include/eval.h @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:30 by charles #+# #+# */ -/* Updated: 2020/09/14 17:20:14 by charles ### ########.fr */ +/* Updated: 2020/09/14 19:49:18 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,7 +24,6 @@ typedef struct { - t_path path; t_env env; t_ast *ast; int fds[2]; @@ -32,7 +31,7 @@ typedef struct typedef struct { - char *exec_path; + char exec_path[PATH_MAX + 1]; char **argv; t_env env; t_builtin_entry *builtin; @@ -49,25 +48,25 @@ extern pid_t g_child_pid; */ int fork_wrap(int fds[2], void *passed, int (*wrapped)(void *param), pid_t *child_pid); -int eval(int fds[2], t_env env, t_path path, t_ast *ast, pid_t *child_pid); +int eval(int fds[2], t_env env, t_ast *ast, pid_t *child_pid); /* ** cmd.c */ -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); /* ** operation.c */ -int eval_operation(int fds[2], t_env env, t_path path, t_ast *ast); +int eval_operation(int fds[2], t_env env, t_ast *ast); /* ** parenthesis.c */ -int eval_parenthesis(int fds[2], t_env env, t_path path, t_ast *ast); +int eval_parenthesis(int fds[2], t_env env, t_ast *ast); /* ** redir.c @@ -80,6 +79,5 @@ int redir_extract(t_tok_lst **redirs, t_env env, int fds[2]); */ int exec_path_check(char *exec_path); -int exec_search_path(t_path path, char *path_var, char *exec_name, char **exec_path); #endif diff --git a/include/minishell.h b/include/minishell.h index 95f299b..0dd0522 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */ -/* Updated: 2020/09/14 15:36:04 by charles ### ########.fr */ +/* Updated: 2020/09/14 19:50:06 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -48,7 +48,6 @@ # define BUILTIN_NOT_FOUND -2 -typedef t_ftht* t_path; typedef t_ftvec* t_env; extern int g_last_status; @@ -58,7 +57,7 @@ extern char *g_basename; ** path.c */ -t_path path_update(t_path path, char *path_var); +bool path_search(t_env env, char *exec_name, char exec_path[PATH_MAX + 1]); /* ** env.c -- cgit