-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap.c
52 lines (49 loc) · 1.54 KB
/
push_swap.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
42
43
44
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ana-lda- <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 14:18:34 by ana-lda- #+# #+# */
/* Updated: 2024/07/06 15:40:54 by ana-lda- ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char **argv)
{
t_stack *stack_a;
//t_stack *stack_b;
stack_a = NULL;
//stack_b = NULL;
if (argc < 2)
return (-1);
if (argc == 2)
argv = ft_split(argv[1], ' ');
else
argv++;
if (!valid_imput(argv, argc))
free_split(argc, argv, true);
else
stack_a = new_stack(argv);
while (stack_a)
{
printf("%d->", stack_a->data);
stack_a = stack_a->next;
}
printf("NULL\n");
free_stack(&stack_a);
free_split(argc, argv, false);
}
/* if (is_sorted(stack_a))
{
free_stack(stack_a);
free_stack(stack_b);
return (0);
}
else
sort_stack(stack_a, stack_b);
free_stack(stack_a);
free_stack(stack_b);
return (0);
} */