1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LibC: Add alphasort() implementation

This is a POSIX API required for the latest stress-ng port.
This commit is contained in:
Brian Gianforcaro 2021-12-27 19:26:37 -08:00 committed by Andreas Kling
parent fa5d81be7a
commit c4b1e49036
2 changed files with 7 additions and 0 deletions

View file

@ -222,6 +222,12 @@ int dirfd(DIR* dirp)
return dirp->fd;
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html
int alphasort(const struct dirent** d1, const struct dirent** d2)
{
return strcoll((*d1)->d_name, (*d2)->d_name);
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/scandir.html
int scandir(const char* dir_name,
struct dirent*** namelist,