summaryrefslogtreecommitdiffstats
path: root/src/ft_process_arg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_process_arg.c')
-rw-r--r--src/ft_process_arg.c22
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);
+}