void ft_sort_params_dir(char **argv, int argc, t_option *op) { if (op->by == 1 && op->rev == 0) ft_sort_params(argv, argc); if (op->by == 1 && op->rev == 1) ft_sort_params_rev(argv, argc); if (op->by == 2) ft_sort_time(argv, argc, op); }
void ft_get_sort(t_ls *ls, t_file *parent, t_file *file) { while (file != NULL && file->prev != NULL) file = file->prev; if (ft_strchr(ls->options, 'f') == NULL) { if (ft_strchr(ls->options, 't') != NULL) { if (ft_strchr(ls->options, 'u') != NULL) file = assign(ls, parent, ft_sort_time_last_access(file)); else file = assign(ls, parent, ft_sort_time(file)); } else file = assign(ls, parent, ft_sort_ascii(file)); if (ft_strchr(ls->options, 'r') != NULL) assign(ls, parent, ft_sort_reverse(file)); } }
void ft_hub_dir(char *dir, t_bol bol) { char **files; char *path; int len; len = ft_count_files(dir); if (len == -1) return ; files = (char **)malloc(sizeof(char *) * len + 1); files = ft_fetch_files(dir, files); path = ft_strjoin(dir, "/"); if (bol.t == 1 && files[0] != NULL) { files = ft_sort_ascii(files, 0); files = ft_sort_time(files, path, bol); } else if (files[0] != NULL) files = ft_sort_ascii(files, bol.r); ft_print_dir(files, bol, dir); free(path); }