mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
LibC: Add alphasort() implementation
This is a POSIX API required for the latest stress-ng port.
This commit is contained in:
parent
fa5d81be7a
commit
c4b1e49036
2 changed files with 7 additions and 0 deletions
|
@ -222,6 +222,12 @@ int dirfd(DIR* dirp)
|
||||||
return dirp->fd;
|
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
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/scandir.html
|
||||||
int scandir(const char* dir_name,
|
int scandir(const char* dir_name,
|
||||||
struct dirent*** namelist,
|
struct dirent*** namelist,
|
||||||
|
|
|
@ -35,6 +35,7 @@ struct dirent* readdir(DIR*);
|
||||||
int readdir_r(DIR*, struct dirent*, struct dirent**);
|
int readdir_r(DIR*, struct dirent*, struct dirent**);
|
||||||
int dirfd(DIR*);
|
int dirfd(DIR*);
|
||||||
|
|
||||||
|
int alphasort(const struct dirent** d1, const struct dirent** d2);
|
||||||
int scandir(const char* dirp, struct dirent*** namelist,
|
int scandir(const char* dirp, struct dirent*** namelist,
|
||||||
int (*filter)(const struct dirent*),
|
int (*filter)(const struct dirent*),
|
||||||
int (*compar)(const struct dirent**, const struct dirent**));
|
int (*compar)(const struct dirent**, const struct dirent**));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue