diff options
Diffstat (limited to 'src/ft_exec.c')
-rw-r--r-- | src/ft_exec.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/ft_exec.c b/src/ft_exec.c index b9d50cf..dffaf3d 100644 --- a/src/ft_exec.c +++ b/src/ft_exec.c @@ -1,14 +1,35 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_exec.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2019/11/01 18:46:50 by rbousset #+# ## ## #+# */ +/* Updated: 2019/11/01 18:47:21 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <minishell.h> #include <unistd.h> int -ft_exec(char **app) +ft_exec(char **com) { uint8_t i; i = 0; - while (app[i]) + while (com[i]) i++; - return (execve(app[0] + 2, app, NULL)); + if (!ft_strncmp(com[0], "./", 2)) + { + if ((execve(com[0] + 2, com, NULL)) != 0) + return (ft_error(com[0], 127)); + } + else + if ((execve(com[0] + 2, com, NULL)) != 0) + return (ft_error(com[0], 127)); + return (0); } |