push_swap.c
1 /* ************************************************************************** */ 2 /* */ 3 /* ::: :::::::: */ 4 /* push_swap.c :+: :+: :+: */ 5 /* +:+ +:+ +:+ */ 6 /* By: gychoi <gychoi@student.42seoul.kr> +#+ +:+ +#+ */ 7 /* +#+#+#+#+#+ +#+ */ 8 /* Created: 2022/10/31 22:50:36 by gychoi #+# #+# */ 9 /* Updated: 2022/12/07 20:52:09 by gychoi ### ########.fr */ 10 /* */ 11 /* ************************************************************************** */ 12 13 #include "push_swap.h" 14 15 int main(int argc, char **argv) 16 { 17 int *array; 18 t_list *list; 19 t_deque *deque_a; 20 t_deque *deque_b; 21 22 if (argc < 2) 23 return (0); 24 list = NULL; 25 deque_a = ps_deqnew(); 26 deque_b = ps_deqnew(); 27 array = get_valid_param(argc, argv); 28 deque_set(deque_a, &list, array, argc); 29 if (!deque_sorted(deque_a)) 30 sort(array, deque_a, deque_b); 31 deque_clear(deque_a, deque_b); 32 free(array); 33 return (0); 34 }