diff options
author | Aymeric Wibo <obiwac@gmail.com> | 2022-08-24 23:20:13 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-08-25 00:29:03 +0000 |
commit | 05c9a0158f6837bb3a3781e4ed75f66115f6415a (patch) | |
tree | 4d1cd92f4537c4c34ab1de0d436bf8b3e618d518 /include/dirent.h | |
parent | 465988e9fa8abb222cfda07a82c8f0bfe0f36074 (diff) | |
download | src-05c9a0158f6837bb3a3781e4ed75f66115f6415a.tar.gz src-05c9a0158f6837bb3a3781e4ed75f66115f6415a.zip |
libc: Add strverscmp(3) and versionsort(3)
Add a strverscmp(3) function to libc, a GNU extension I implemented by
reading its glibc manual page. It orders strings following a much more
natural ordering (e.g. "ent1 < ent2 < ent10" as opposed to
"ent1 < ent10 < ent2" with strcmp(3)'s lexicographic ordering).
Also add versionsort(3) for use as scandir(3)'s compar argument.
Update manual page for scandir(3) and add one for strverscmp(3).
Reviewed by: pstef, gbe, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35807
Diffstat (limited to 'include/dirent.h')
-rw-r--r-- | include/dirent.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/dirent.h b/include/dirent.h index 047206258471..751a016838c0 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -108,6 +108,7 @@ int alphasort(const struct dirent **, const struct dirent **); int dirfd(DIR *); #endif #if __BSD_VISIBLE +int versionsort(const struct dirent **, const struct dirent **); DIR *__opendir2(const char *, int); int fdclosedir(DIR *); ssize_t getdents(int, char *, size_t); |