t_dlist *ft_choose(char *arg, t_dlist *list) { int index; index = 0; while (arg[index] == ' ' || arg[index] == '\t' || arg[index] == '\n' || arg[index] == '\r') index++; if (ft_strncmp("cd", arg, 2) == 0) ft_run_cd(arg, list, NULL, NULL); else if (ft_strncmp("echo", arg, 4) == 0) ft_run_echo(arg, list); else if (ft_strncmp("setenv", arg, 6) == 0) ft_run_setenv(arg, list); else if (ft_strncmp("env", arg, 3) == 0) ft_display_list(list); else if (ft_strncmp("unsetenv", arg, 8) == 0) ft_run_unsetenv(arg + 8, list); else if (ft_strncmp("exit", arg, 4) == 0 && ft_strlen(arg) == 4) { ft_delete_list(&list); return (list); } else if (ft_check_arg(arg + index, list, 0, ft_boucle(arg)) == 0) ft_error(arg, 3); return (list); }
int ft_del(t_param *p, t_list *list, t_termios *term) { ft_list_remove(p, &list, p->pos.y); p->pos.y = p->pos.y < p->count ? p->pos.y + 0 : 0; ft_clear_area(); ft_display_list(list); ft_line(ft_ret_elt(list, p->pos.y)->data, p->pos.y, ft_ret_elt(list, p->pos.y)->valid, 1); }