summaryrefslogtreecommitdiffstats
path: root/src/ft_process_arg.c
blob: d82f9da0c10996379b7b738180d7c66733595cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}