summaryrefslogtreecommitdiffstats
path: root/src/ft_process_arg.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-29 13:54:42 +0100
committerRudy Bousset <rbousset@z2r5p6.le-101.fr>2019-10-29 13:54:42 +0100
commit53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b (patch)
tree54b22e10c806be22e1d7e3c2be5f848d012f5ab8 /src/ft_process_arg.c
parenttons of changes (diff)
download42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.gz
42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.bz2
42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.xz
42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.tar.zst
42-minishell-53a5dc3296b363cdb3375dfa7ef3ff582d3cbd1b.zip
commit, lotta stuff
Diffstat (limited to 'src/ft_process_arg.c')
-rw-r--r--src/ft_process_arg.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ft_process_arg.c b/src/ft_process_arg.c
index d82f9da..e1b6f8f 100644
--- a/src/ft_process_arg.c
+++ b/src/ft_process_arg.c
@@ -3,11 +3,22 @@
#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;
uint8_t i;
+ if (arg[0] == '\0')
+ return (0);
i = 0;
com = ft_split(arg, ' ');
while (com[i])
@@ -18,5 +29,7 @@ ft_process_arg(const char *arg)
ft_echo(com, i);
else if (!ft_strncmp(com[0], "pwd", ft_strlen(com[0])))
ft_pwd();
+ else
+ ft_not_found(com[0]);
return (0);
}