-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap_checker.c
41 lines (38 loc) · 1.3 KB
/
push_swap_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
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap_checker.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mokhan <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/23 00:39:38 by mokhan #+# #+# */
/* Updated: 2023/12/23 00:39:39 by mokhan ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char **argv)
{
struct s_data d;
char **argm;
int i;
d.b = NULL;
if (argc == 2)
{
i = 0;
argm = ft_split(argv[1], ' ');
while (argm[i])
i++;
d.a = init_stack(&d, i, argm, 0);
ft_free((void **)argm);
}
else
d.a = init_stack(&d, argc - 1, argv, 1);
if (argc > 1)
{
get_input(&d);
ps_lstclear(&d.a);
if (is_sorted(d.a) == 0)
ps_lstclear(&d.b);
}
return (0);
}