t_bool ft_check_cmd(t_llist *list, t_llist *left, t_ast **ast) { t_bool cmd; cmd = FALSE; while (list && list->arg_type != STOP) { if (list->arg_type == T_CMD && left) ft_add_cmd(ast, &list, &cmd); else if (list->arg_type == T_RFL || list->arg_type == T_RFR || list->arg_type == T_RFRR) { if ((list = list->next) && list->arg_type == T_CMD) { if (cmd == TRUE && list->next && list->next->arg_type == T_CMD) return (ft_print_prserr(list)); ft_add_file(ast, list); } else return (ft_print_prserr(list)); } if (list && list->arg_type != STOP) list = list->next; } *ast = (*ast)->first; return (TRUE); }
void ls_rec(t_mem *s, char *path) { DIR *rep; struct dirent *fichier; t_fil *list; rep = NULL; list = NULL; if (my_opendir(path, &rep, s) != 0) { while ((fichier = readdir(rep)) != NULL) ft_add_file(s, fichier, path, &list); if (my_closedir(path, &rep) != 0) ls_rec2(s, &list, path); } }