-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
40 lines (37 loc) · 1.4 KB
/
main.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* main.c :+: :+: */
/* +:+ */
/* By: sramos <[email protected]> +#+ */
/* +#+ */
/* Created: 2024/02/26 15:33:01 by sramos #+# #+# */
/* Updated: 2024/04/26 20:46:19 by sramos ######## odam.nl */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char *argv[])
{
char **parsed;
t_node *stack_a;
parsed = NULL;
stack_a = NULL;
if (argc < 2)
return (0);
if (argc >= 2)
parsed = arg_parser(argc, argv);
if (arg_checker(parsed))
{
write(2, "Error\n", 6);
if (argc == 2 && ft_strchr(argv[1], ' '))
ft_freesplit(parsed);
return (0);
}
stack_a = ft_create_ll(parsed, stack_a);
if (check_sorted(&stack_a))
sorting(&stack_a);
if (argc == 2 && ft_strchr(argv[1], ' '))
ft_freesplit(parsed);
ft_free_ll(stack_a);
return (0);
}