diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-06-13 11:14:38 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-06-13 11:14:38 -0400 |
commit | fbffcee63dde1cba27021177d2ed9ba4f3792a57 (patch) | |
tree | d5c6c7e8b410cfd7fc85e6a08e0843511e6150e9 /src/dirent | |
parent | e361019c24b4dc930aa9431b895b478e1eee04e0 (diff) | |
download | musl-fbffcee63dde1cba27021177d2ed9ba4f3792a57.tar.gz musl-fbffcee63dde1cba27021177d2ed9ba4f3792a57.tar.bz2 musl-fbffcee63dde1cba27021177d2ed9ba4f3792a57.tar.xz musl-fbffcee63dde1cba27021177d2ed9ba4f3792a57.zip |
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.
Diffstat (limited to 'src/dirent')
-rw-r--r-- | src/dirent/versionsort.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dirent/versionsort.c b/src/dirent/versionsort.c new file mode 100644 index 00000000..97696105 --- /dev/null +++ b/src/dirent/versionsort.c @@ -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); +} |