From f41dde0d66ce1a060c14ec2c1eb9b4f03b59f876 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Wed, 30 Oct 2019 17:38:55 +0100 Subject: in progress --- Makefile | 3 ++- inc/minishell.h | 1 + src/ft_exec.c | 10 ++++++++++ src/ft_process_arg.c | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/ft_exec.c diff --git a/Makefile b/Makefile index 1e0ea0a..28ab638 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,10 @@ SRCS = \ ${SRCS_DIR}main.c \ ${SRCS_DIR}ft_process_arg.c \ ${SRCS_DIR}ft_error.c \ + ${SRCS_DIR}ft_exit.c \ ${SRCS_DIR}ft_echo.c \ ${SRCS_DIR}ft_pwd.c \ - ${SRCS_DIR}ft_exit.c + ${SRCS_DIR}ft_exec.c \ OBJS_DIR = obj/ OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS}) diff --git a/inc/minishell.h b/inc/minishell.h index ecc693a..3dfc3ae 100644 --- a/inc/minishell.h +++ b/inc/minishell.h @@ -8,5 +8,6 @@ int ft_echo(char **com, uint8_t n); int ft_pwd(void); uint8_t ft_exit(char **com); int ft_error(const char *com, int errno); +int ft_exec(char **app); #endif diff --git a/src/ft_exec.c b/src/ft_exec.c new file mode 100644 index 0000000..0c950e4 --- /dev/null +++ b/src/ft_exec.c @@ -0,0 +1,10 @@ +#include +#include +#include + +int +ft_exec(char **app) +{ + (void)app; + return (0); +} diff --git a/src/ft_process_arg.c b/src/ft_process_arg.c index 9a1b620..75999b9 100644 --- a/src/ft_process_arg.c +++ b/src/ft_process_arg.c @@ -20,6 +20,8 @@ ft_process_arg(const char *arg) return (ft_echo(com, i)); else if (!ft_strncmp(com[0], "pwd", ft_strlen(com[0]))) return (ft_pwd()); + else if (!ft_strncmp(com[0], "./", 2)) + ft_exec(com); else return (ft_error(com[0], 127)); return (0); -- cgit v1.2.3