void ls(t_args *args) { t_array *files; t_array *dirs; t_array *errs; files = ft_arraynew(); dirs = ft_arraynew(); errs = ft_arraynew(); ls_args(files, dirs, errs, args); ls_errs(errs, args); ls_files(files, args); ls_dirs(dirs, args, files->length); ft_arraykil(files, &kill_file); }
void ls_loop(char *options, t_arraylist *filedirs, char dots) { t_arraylist *dirs; t_arlst_iter *iter; int iter_ret; if (!filedirs) return ; dirs = ls_dirs(options, filedirs); if (!dirs) return ; iter = arlst_iter(dirs); if (ft_strchr(options, 'r')) iter->pip = iter->pop; iter_ret = 1; while (iter_ret) { ls_loop_content(options, iter->pip(iter, &iter_ret), dots); } free(iter); dirs->del(dirs); del_filedir_arlst(filedirs); }