summaryrefslogtreecommitdiff
path: root/libc/misc/dirent/versionsort.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-02-08 22:40:17 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-02-08 22:40:17 +0000
commit1a2c9641465f2c64fbb49749688ca465ad3cd6fe (patch)
treeca3cdb783459f014263c7ca200d0a66b8e9856b8 /libc/misc/dirent/versionsort.c
parent7cccb9c2531088502492d92e8632159653de6290 (diff)
Add strverscmp() and versionsort[64]().
By Hai Zaar (haizaar AT codefidence.com)
Diffstat (limited to 'libc/misc/dirent/versionsort.c')
-rw-r--r--libc/misc/dirent/versionsort.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libc/misc/dirent/versionsort.c b/libc/misc/dirent/versionsort.c
new file mode 100644
index 000000000..53476e67f
--- /dev/null
+++ b/libc/misc/dirent/versionsort.c
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2008-2009 Hai Zaar, Codefidence Ltd <haizaar@codefidence.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <dirent.h>
+#include <string.h>
+#include "dirstream.h"
+
+int versionsort(const void *a, const void *b)
+{
+ return strverscmp((*(const struct dirent **) a)->d_name,
+ (*(const struct dirent **) b)->d_name);
+}