-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
42 lines (39 loc) · 1.44 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
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hhamza <hhamza@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/07 12:19:48 by hhamza #+# #+# */
/* Updated: 2022/02/28 09:28:34 by hhamza ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_parser.h"
#include "ft_stack.h"
#include "libft.h"
#include "push_swap.h"
int main(int argc, char **argv)
{
t_stack *stack_a;
t_stack *stack_b;
if (argc == 1)
return (EXIT_FAILURE);
stack_a = ft_parser(argc, argv);
if (stack_a == NULL)
{
ft_putendl_fd("Error", STDERR_FILENO);
return (EXIT_FAILURE);
}
stack_b = ft_stack_new();
if (stack_b == NULL)
{
ft_stack_clear(&stack_a);
return (EXIT_FAILURE);
}
if (ft_sort(stack_a, stack_b) == FALSE)
return (EXIT_FAILURE);
ft_stack_clear(&stack_a);
ft_stack_clear(&stack_b);
return (EXIT_SUCCESS);
}