From 7cbf04d592608cf36832e25f9b41619df733e0ae Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Fri, 1 Nov 2019 18:57:16 +0100 Subject: commit --- src/ft_exec.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/ft_exec.c') 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 +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2019/11/01 18:46:50 by rbousset #+# ## ## #+# */ +/* Updated: 2019/11/01 18:47:21 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include #include #include 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); } -- cgit v1.2.3