HomeFreeBSD

libc: Add strverscmp(3) and versionsort(3)

Description

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

Details

Provenance
obiwac_gmail.comAuthored on Aug 24 2022, 11:20 PM
kibCommitted on Aug 25 2022, 12:29 AM
Reviewer
pstef
Differential Revision
D35807: libc: Add `strverscmp(3)` & `versionsort(3)`
Parents
rG465988e9fa8a: NOTES: Update the comment for MCLSHIFT
Branches
Unknown
Tags
Unknown