static int	cmd_handler(t_fct *tmp, char *buf, char ***new_av, int cs)
{
	int		bool;

	*new_av = ft_strsplit_blank(buf);
	bool = 0;
	while (tmp != NULL)
	{
		if (*new_av[0] && ft_strcmp(tmp->name, *new_av[0]) == 0)
		{
			bool = 1;
			tmp->ptr_funct(*new_av, cs);
			return (1);
		}
		tmp = tmp->next;
	}
Beispiel #2
0
static void	fill_av(t_av *av, char *str)
{
	int		j;
	int		k;

	j = 0;
	ft_bzero(av,sizeof(t_av));
	while (ft_isblank(str[j]) == 1 && str[j] != '\0')
		j++;
	k = j;
	while (ft_isspace(str[k]) == 0 && str[k] != '\0')
		k++;
	av->cmd = ft_strsub(str, j, k - j);
	av->arg = ft_strsplit_blank(str + k);
	k = -1;
	while (av->arg != NULL && av->arg[++k] != NULL)
		av->argc++;
}