blob: 75999b9692817c4f2d00d1cf5b7db293f3ff0c79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <libft.h>
#include <minishell.h>
#include <inttypes.h>
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])
i++;
if (!ft_strncmp(com[0], "exit", ft_strlen(com[0])))
return (ft_exit(com));
else if (!ft_strncmp(com[0], "echo", ft_strlen(com[0])))
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);
}
|