add (currently stubbed due to stubbed strverscmp) versionsort function
based on patch by Emil Renner Berthing, with minor changes to dirent.h for LFS64 and organization of declarations this code should work unmodified once a real strverscmp is added, but I've been hesitant to add it because the GNU strverscmp behavior is harmful in a lot of cases (for instance if you have numeric filenames in hex). at some point I plan on trying to design a variant of the algorithm that behaves better on a mix of filename styles.
This commit is contained in:
parent
e361019c24
commit
fbffcee63d
2 changed files with 13 additions and 0 deletions
8
src/dirent/versionsort.c
Normal file
8
src/dirent/versionsort.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
||||
int versionsort(const struct dirent **a, const struct dirent **b)
|
||||
{
|
||||
return strverscmp((*a)->d_name, (*b)->d_name);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue