Files
42_INT_06_pushwap/srcs/stop.c
2021-06-14 22:36:42 +02:00

32 lines
560 B
C

#include "push_swap.h"
void ps_usage(void)
{
ft_printf("usage :\n");
ft_printf("launch executable : ./push_swap [flag -p] nb nb nb nb nb ...\n");
}
void ps_error(int err)
{
if (err == 1)
ps_usage();
if (err == 2)
ft_printf("error\n");
}
void ps_stop(t_stack *stack_a, t_stack *stack_b, t_list *solution, int err)
{
if (stack_a)
ft_lstclear((t_list **)&stack_a, NULL);
if (stack_b)
ft_lstclear((t_list **)&stack_b, NULL);
if (solution)
ft_lstclear(&solution, free);
if (err < 0)
return ;
else if (err > 0)
ps_error(err);
exit(0);
}