-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecker.c
39 lines (36 loc) · 1.37 KB
/
checker.c
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
29
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* checker.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zhlim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/04 15:52:10 by zhlim #+# #+# */
/* Updated: 2023/08/10 23:30:09 by zhlim ### ########.fr */
/* */
/* ************************************************************************** */
#include "checker.h"
int main(int ac, char **av)
{
t_list *stack_a;
t_list *stack_b;
char **args;
int to_free;
to_free = 0;
args = validate_args(ac, av, &to_free);
stack_a = build_stack_a(args);
if (to_free)
free_args(args);
stack_b = NULL;
check_dup(stack_a);
if (check_sorted(stack_a))
ft_printf("OK\n");
else
{
run_checker(&stack_a, &stack_b);
if (stack_b || !check_sorted(stack_a))
free_error_exit("KO\n", stack_a);
ft_printf("OK\n");
}
ft_lstclear(&stack_a, destroy_content);
}