diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2019-10-29 13:22:04 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2019-10-29 13:22:04 +0100 |
commit | 079d839aee68e52932eacbd8d4c75ba1388b006a (patch) | |
tree | 406665acdbfa9e61fbccad924d4dcc27de0463e1 /src/ft_process_arg.c | |
parent | libft included (diff) | |
download | 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.gz 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.bz2 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.xz 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.tar.zst 42-minishell-079d839aee68e52932eacbd8d4c75ba1388b006a.zip |
tons of changes
Diffstat (limited to '')
-rw-r--r-- | src/ft_process_arg.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ft_process_arg.c b/src/ft_process_arg.c new file mode 100644 index 0000000..d82f9da --- /dev/null +++ b/src/ft_process_arg.c @@ -0,0 +1,22 @@ +#include <libft.h> +#include <minishell.h> +#include <inttypes.h> + +int +ft_process_arg(const char *arg) +{ + char **com; + uint8_t i; + + i = 0; + com = ft_split(arg, ' '); + while (com[i]) + i++; + if (!ft_strncmp(com[0], "exit", ft_strlen(com[0]))) + return (8); + else if (!ft_strncmp(com[0], "echo", ft_strlen(com[0]))) + ft_echo(com, i); + else if (!ft_strncmp(com[0], "pwd", ft_strlen(com[0]))) + ft_pwd(); + return (0); +} |