[newlib-cygwin] cygwin: export strverscmp, add versionsort

Yaakov Selkowitz yselkowitz@sourceware.org
Mon Jun 19 13:17:00 GMT 2017


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f698efbce167768d9c859c07dd2bebc75ade7728

commit f698efbce167768d9c859c07dd2bebc75ade7728
Author: Yaakov Selkowitz <yselkowi@redhat.com>
Date:   Wed Jun 14 15:26:38 2017 -0500

    cygwin: export strverscmp, add versionsort
    
    Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

Diff:
---
 winsup/cygwin/common.din               | 2 ++
 winsup/cygwin/include/cygwin/version.h | 3 ++-
 winsup/cygwin/include/sys/dirent.h     | 1 +
 winsup/cygwin/release/2.8.1            | 2 ++
 winsup/cygwin/scandir.cc               | 6 ++++++
 winsup/doc/posix.xml                   | 2 ++
 6 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index 75fe05c..9331653 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1396,6 +1396,7 @@ strtoull NOSIGFE
 strtoull_l NOSIGFE
 strtoumax = strtoull NOSIGFE
 strupr NOSIGFE
+strverscmp NOSIGFE
 strxfrm NOSIGFE
 strxfrm_l NOSIGFE
 swab NOSIGFE
@@ -1492,6 +1493,7 @@ vasprintf SIGFE
 vdprintf SIGFE
 verr SIGFE
 verrx SIGFE
+versionsort NOSIGFE
 vfiprintf SIGFE
 vfork SIGFE
 vfprintf SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index c0254a8..bde358f 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -476,12 +476,13 @@ details. */
   309: Export getloadavg.
   310: Export reallocarray.
   311: Export __xpg_sigpause.
+  312: Export strverscmp, versionsort.
 
   Note that we forgot to bump the api for ualarm, strtoll, strtoull,
   sigaltstack, sethostname. */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 311
+#define CYGWIN_VERSION_API_MINOR 312
 
 /* There is also a compatibity version number associated with the shared memory
    regions.  It is incremented when incompatible changes are made to the shared
diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h
index 771f716..049e87a 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -89,6 +89,7 @@ int alphasort (const struct dirent **__a, const struct dirent **__b);
 int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist,
 	       int (*select) (const struct dirent *),
 	       int (*compar) (const struct dirent **, const struct dirent **));
+int versionsort (const struct dirent **__a, const struct dirent **__b);
 #endif
 
 #if __BSD_VISIBLE
diff --git a/winsup/cygwin/release/2.8.1 b/winsup/cygwin/release/2.8.1
index 1ebe7d8..d03f296 100644
--- a/winsup/cygwin/release/2.8.1
+++ b/winsup/cygwin/release/2.8.1
@@ -5,6 +5,8 @@ What's new:
 
 - New API: reallocarray
 
+- New API: strverscmp, versionsort.
+
 
 What changed:
 -------------
diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc
index 1c324c1..d6ac649 100644
--- a/winsup/cygwin/scandir.cc
+++ b/winsup/cygwin/scandir.cc
@@ -20,6 +20,12 @@ alphasort (const struct dirent **a, const struct dirent **b)
 }
 
 extern "C" int
+versionsort (const struct dirent **a, const struct dirent **b)
+{
+  return strverscmp ((*a)->d_name, (*b)->d_name);
+}
+
+extern "C" int
 scandir (const char *dir,
 	 struct dirent ***namelist,
 	 int (*select) (const struct dirent *),
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index ced7e38..7e28427 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1367,6 +1367,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
     strtoll_l
     strtoul_l
     strtoull_l
+    strverscmp
     sysinfo
     tdestroy
     timegm
@@ -1377,6 +1378,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
     vasnprintf
     vasprintf
     vasprintf_r
+    versionsort
     wcsftime_l
     wcstod_l
     wcstof_l



More information about the Cygwin-cvs mailing list