Added sorting based on http://pubs.opengroup.org/onlinepubs/9699919799/functions/scandir.html
gethread.c 37c37 < DIR *dir; --- > 38a39 > struct dirent **namelist; 44c45,47 < int isdir,skip; --- > int isdir,skip, n, i; 49c52,54 < if ((NODIRLIST) || ((dir = opendir(dirname)) == NULL)) --- > if (NODIRLIST) 73c78,81 < while ((ent = readdir(dir)) != NULL) --- > n = scandir(dirname, &namelist, 0, alphasort); > for(i = 0; i < n; i++) { > > ent = namelist[i]; 117,118c125,126 < < closedir(dir); --- > free(namelist[i]); > }