mini transformation dans les actions qui a tout casse

This commit is contained in:
hugogogo
2021-06-12 14:26:15 +02:00
parent ca0bf0cb61
commit 889c3f4a99
11 changed files with 86 additions and 48 deletions

View File

@@ -9,6 +9,15 @@ void is_valid(int ac, char **av)
// check more error
}
int check_flag(int *ac, char ***av)
{
if (ft_strcmp((*av)[1], "-p") != 0)
return (0);
(*av)++;;
(*ac)--;
return (1);
}
t_stack *init_stack(int ac, char **av)
{
t_stack *start;
@@ -30,11 +39,13 @@ int main(int ac, char **av)
{
t_stack *stack;
t_list *result;
int flag;
is_valid(ac, av); // check if usage and list are correct
flag = check_flag(&ac, &av); //check for flag, like print
stack = init_stack(ac, av); // create the list from av[]
result = sort_algo(stack);
ft_printf("\n%s\n", result->content);
result = sort_algo(stack, flag);
print_result(result);
ps_stop(stack, NULL, result, 0);
return(0);
}