void get_linked_lists(t_dlist **dirs_to_open, t_params *p, int ac, char **av) { t_dlist *params_files; params_files = NULL; *dirs_to_open = get_dirs_to_open(av, ac, ¶ms_files, search_params(ac, av, p)); if (p->colors) p->colors_tab = get_env_colors(); files_first_ladies(params_files, p); if (*dirs_to_open && params_files) ft_putchar('\n'); if (ft_dlstlen(*dirs_to_open) > 1) sort_params_dirs(dirs_to_open); if (params_files) ft_dlstdel(¶ms_files, NULL); }
static int sort_query(struct query_sort *qs) { search_query(qs); if (qs->query_string == NULL) { qs->append(qs, qs->url); return QS_OK; } qs->copy(qs, qs->url, qs->query_string - qs->url); int return_code = QS_OK; if( EOQS(qs->query_string[0]) ) { // no params, append the end of the url qs->append(qs, qs->query_string); } else { /* count query parameters... */ count_params(qs); /* ...in order to allocate an array on the stack */ struct query_param params[qs->count]; qs->params = params; /* search and sort the parameters */ const char *eoqs = search_params(qs); qsort(params, qs->count, sizeof(struct query_param), compare_params); /* append the sorted parameters and the end of the url */ if ( append_params(qs) ) { return_code = QS_CLEANED; } qs->append(qs, eoqs); } return return_code; }