void ft_operation(t_env *env, char *s) { int i; i = env->begin ? 1 : 0; if (i) env->begin = 0; if (env->r) { if (i) ft_print_color(s); else { ft_putchar(' '); ft_print_color(s); } } else { if (i) ft_putstr(s); else { ft_putchar(' '); ft_putstr(s); } } }
void error_code(int status) { if (status == 0) { ft_print_color(RED, "Error: Arguments incorrects\n", 2); ft_print_color(RED, "Only numbers and no double\n", 2); } if (status == 1) ft_print_color(RED, "Error: Malloc\n", 2); if (status == 2) ft_print_color(RED, "Options invalid\n", 2); exit(1); }
int swap(t_lst **lst) { t_lst *tmp; int swap; if (!(*lst)->next) return (0); tmp = *lst; if (tmp->name == 'a') ft_print_color(BLUE, "sa ", 1); else ft_print_color(YELLOW, "sb ", 1); while (tmp && tmp->next && tmp->next->next) tmp = tmp->next; swap = tmp->data; tmp->data = tmp->next->data; tmp->next->data = swap; return (1); }
void resolution(t_lst *lsta, t_lst *lstb) { if (verif_rotate_a(lsta) == 1) { rev_rotate(&lsta); apply_opt_v(lsta, lstb); } if (verif_rotate_a(lsta) == 2) { rotate(&lsta); apply_opt_v(lsta, lstb); } while (is_sort(lsta, lstb)) { while (a_is_sort(lsta) == 1) resolve_a(&lsta, &lstb); while (is_sort(lsta, lstb) == 2) resolve_b(&lsta, &lstb); remove_list(&lsta, &lstb); } ft_print_color(MAGENTA, "\n\nEnd:", 1); print_lst(lsta, lstb); }