bug dans sort qui semble marcher mais ne passe pas le checker par contre parsing arguments fonctionne dans les deux modes
This commit is contained in:
@@ -25,23 +25,40 @@ int check_flag(int *ac, char ***av)
|
||||
return (0);
|
||||
}
|
||||
|
||||
t_stack *fill_stack(t_stack *list, char *nb)
|
||||
{
|
||||
t_stack *new;
|
||||
|
||||
new = ft_calloc(1, sizeof(t_stack));
|
||||
if (!new)
|
||||
ps_stop(NULL, NULL, 2);
|
||||
new->n = ft_atoi(nb);
|
||||
new->limit = 0;
|
||||
new->next = list;
|
||||
list = new;
|
||||
return (list);
|
||||
}
|
||||
|
||||
t_stack *init_stack(int ac, char **av)
|
||||
{
|
||||
t_stack *start;
|
||||
t_stack *tmp;
|
||||
char **split;
|
||||
t_stack *list;
|
||||
int i;
|
||||
|
||||
tmp = NULL;
|
||||
while (--ac)
|
||||
list = NULL;
|
||||
if (ac > 2)
|
||||
while (--ac)
|
||||
list = fill_stack(list, av[ac]);
|
||||
else if (ac == 2)
|
||||
{
|
||||
start = ft_calloc(1, sizeof(t_stack));
|
||||
if (!start)
|
||||
ps_stop(NULL, NULL, 2);
|
||||
start->n = ft_atoi(av[ac]);
|
||||
start->limit = 0;
|
||||
start->next = tmp;
|
||||
tmp = start;
|
||||
split = ft_split(av[1], ' ');
|
||||
i = 0;
|
||||
while (split[i] != NULL)
|
||||
i++;
|
||||
while (--i >= 0)
|
||||
list = fill_stack(list, split[i]);
|
||||
}
|
||||
return (start);
|
||||
return (list);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user