summaryrefslogtreecommitdiffstats
path: root/src/ft_process_arg.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 16:32:46 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-30 16:32:46 +0100
commit27ea0240a97d0745dda0f87940bfe5940f9c594c (patch)
treeb64a14ea7c3a8091c8127df3a3f2ed11060f08b4 /src/ft_process_arg.c
parentNew libft, feelsgoodman (diff)
download42-minishell-27ea0240a97d0745dda0f87940bfe5940f9c594c.tar.gz
42-minishell-27ea0240a97d0745dda0f87940bfe5940f9c594c.tar.bz2
42-minishell-27ea0240a97d0745dda0f87940bfe5940f9c594c.tar.xz
42-minishell-27ea0240a97d0745dda0f87940bfe5940f9c594c.tar.zst
42-minishell-27ea0240a97d0745dda0f87940bfe5940f9c594c.zip
work work
Diffstat (limited to 'src/ft_process_arg.c')
-rw-r--r--src/ft_process_arg.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/ft_process_arg.c b/src/ft_process_arg.c
index e1b6f8f..4f6ccf6 100644
--- a/src/ft_process_arg.c
+++ b/src/ft_process_arg.c
@@ -3,15 +3,6 @@
#include <inttypes.h>
int
-ft_not_found(const char *com)
-{
- ft_putstr("joe-sh: ");
- ft_putstr(com);
- ft_putendl(": command not found");
- return (127);
-}
-
-int
ft_process_arg(const char *arg)
{
char **com;
@@ -24,12 +15,12 @@ ft_process_arg(const char *arg)
while (com[i])
i++;
if (!ft_strncmp(com[0], "exit", ft_strlen(com[0])))
- return (8);
+ return (ft_exit(com));
else if (!ft_strncmp(com[0], "echo", ft_strlen(com[0])))
- ft_echo(com, i);
+ return (ft_echo(com, i));
else if (!ft_strncmp(com[0], "pwd", ft_strlen(com[0])))
- ft_pwd();
+ return (ft_pwd());
else
- ft_not_found(com[0]);
+ return (ft_error(com[0]), 127);
return (0);
}