summaryrefslogtreecommitdiffstats
path: root/src/ft_exec.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 18:16:42 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 18:16:42 +0100
commit2dff0d522812e7e1e32f87e6edf21100e268e0ed (patch)
treeeb54cb1056ebbb194f46e1fbeb2715ebc985406e /src/ft_exec.c
parentin progress (diff)
download42-minishell-2dff0d522812e7e1e32f87e6edf21100e268e0ed.tar.gz
42-minishell-2dff0d522812e7e1e32f87e6edf21100e268e0ed.tar.bz2
42-minishell-2dff0d522812e7e1e32f87e6edf21100e268e0ed.tar.xz
42-minishell-2dff0d522812e7e1e32f87e6edf21100e268e0ed.tar.zst
42-minishell-2dff0d522812e7e1e32f87e6edf21100e268e0ed.zip
work work
Diffstat (limited to 'src/ft_exec.c')
-rw-r--r--src/ft_exec.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ft_exec.c b/src/ft_exec.c
index 0c950e4..7177f5b 100644
--- a/src/ft_exec.c
+++ b/src/ft_exec.c
@@ -1,10 +1,18 @@
#include <libft.h>
#include <minishell.h>
-#include <uinstd.h>
+#include <unistd.h>
int
ft_exec(char **app)
{
- (void)app;
+ uint8_t i;
+
+ i = 0;
+ while (app[i])
+ i++;
+ if (i < 2)
+ return (execve(app[0] + 2, NULL, NULL));
+ else
+ return (execve(app[0] + 2, &app[1], NULL));
return (0);
}