-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap.c
41 lines (38 loc) · 1.37 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aconceic <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/13 20:29:04 by aconceic #+# #+# */
/* Updated: 2024/01/22 08:33:19 by aconceic ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char **argv)
{
t_stack *stack_a;
if (argc < 2 || (argc == 2 && argv[1][0] == '\0'))
return (0);
if (argc == 2)
argv = ft_split(argv[1], ' ');
else
argv = argv + 1;
if (validade_input(argv) == 1)
{
stack_a = st_init_stack(argv);
if (srt_verify_sorting(&stack_a) == 0)
{
srt_sort_stack(&stack_a);
st_list_free(stack_a);
}
else
st_list_free(stack_a);
}
else
write(2, "Error\n", 6);
if (argc == 2)
ft_free_all(argv);
return (0);
}