-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
42 lines (39 loc) · 1.35 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: moel-asr <moel-asr@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/19 11:46:18 by moel-asr #+# #+# */
/* Updated: 2023/01/10 23:56:07 by moel-asr ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char **argv)
{
int i;
int j;
t_list *head_a;
t_list *head_b;
char **strs;
i = 1;
head_a = NULL;
head_b = NULL;
if (argc > 1)
{
while (argv[i])
{
check_null_and_space(argv[i]);
j = 0;
strs = ft_split(argv[i++], ' ');
while (strs[j])
ft_lstadd_back(&head_a, ft_lstnew(ft_atoi(strs[j++]), 0));
ft_free(strs);
}
}
if (check_stack_a(head_a) == 0)
return (0);
sort_stacks(&head_a, &head_b);
return (0);
}