aboutsummaryrefslogtreecommitdiff
path: root/src/eval/cmd.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-14 20:48:50 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-14 21:35:51 +0200
commita2a51b77a5534978f30f2788f7ed9cbe4fda3089 (patch)
tree628d23cfbe2f1badc5e5fac1a647fd40f10d0fc9 /src/eval/cmd.c
parent3693acaff9fbf3f34dc2907e95dd221d5a8bc9e4 (diff)
downloadminishell-a2a51b77a5534978f30f2788f7ed9cbe4fda3089.tar.gz
minishell-a2a51b77a5534978f30f2788f7ed9cbe4fda3089.tar.bz2
minishell-a2a51b77a5534978f30f2788f7ed9cbe4fda3089.zip
Removing path hash table, replacing it by brute force search
Diffstat (limited to 'src/eval/cmd.c')
-rw-r--r--src/eval/cmd.c14
1 files changed, 7 insertions, 7 deletions
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 <charles@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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], &param.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);