-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap.c
executable file
·42 lines (38 loc) · 1.45 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anraymon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/05 01:27:25 by anraymon #+# #+# */
/* Updated: 2023/12/05 01:27:25 by anraymon ### ########.fr */
/* */
/* ************************************************************************** */
#include "./push_swap.h"
int ctrl_err(t_list_node **stack_1, t_list_node **stack_2, int success)
{
if (success)
return (1);
putstr("Error\n", 2);
if (stack_1)
list_clear(stack_1);
if (stack_2)
list_clear(stack_2);
exit(EXIT_FAILURE);
return (0);
}
int main(int argc, char **argv)
{
t_list_node *stack_1;
t_list_node *stack_2;
stack_1 = NULL;
stack_2 = NULL;
if (argc < 2)
exit(EXIT_SUCCESS);
parser(argc, argv, &stack_1);
algorithm(&stack_1, &stack_2);
list_clear(&stack_1);
list_clear(&stack_2);
exit(EXIT_SUCCESS);
}