summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-06-13 11:14:38 -0400
committerRich Felker <dalias@aerifal.cx>2012-06-13 11:14:38 -0400
commitfbffcee63dde1cba27021177d2ed9ba4f3792a57 (patch)
treed5c6c7e8b410cfd7fc85e6a08e0843511e6150e9 /include
parente361019c24b4dc930aa9431b895b478e1eee04e0 (diff)
downloadmusl-fbffcee63dde1cba27021177d2ed9ba4f3792a57.tar.gz
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 'include')
-rw-r--r--include/dirent.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/dirent.h b/include/dirent.h
index cb8cb248..6241220f 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -50,12 +50,17 @@ int scandir(const char *, struct dirent ***, int (*)(const struct dirent *), int
#define DTTOIF(x) ((x)<<12)
#endif
+#ifdef _GNU_SOURCE
+int versionsort(const struct dirent **, const struct dirent **);
+#endif
+
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
#define dirent64 dirent
#define readdir64 readdir
#define readdir64_r readdir_r
#define scandir64 scandir
#define alphasort64 alphasort
+#define versionsort64 versionsort
#define off64_t off_t
#define ino64_t ino_t
#endif