From f698efbce167768d9c859c07dd2bebc75ade7728 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 14 Jun 2017 15:26:38 -0500 Subject: [PATCH] cygwin: export strverscmp, add versionsort Signed-off-by: Yaakov Selkowitz --- 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 75fe05c1f..93316532c 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 c0254a8e0..bde358f72 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 771f71620..049e87ad0 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 1ebe7d839..d03f29647 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 1c324c196..d6ac64907 100644 --- a/winsup/cygwin/scandir.cc +++ b/winsup/cygwin/scandir.cc @@ -19,6 +19,12 @@ alphasort (const struct dirent **a, const struct dirent **b) return strcoll ((*a)->d_name, (*b)->d_name); } +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, diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml index ced7e383d..7e28427b4 100644 --- a/winsup/doc/posix.xml +++ b/winsup/doc/posix.xml @@ -1367,6 +1367,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). strtoll_l strtoul_l strtoull_l + strverscmp sysinfo tdestroy timegm @@ -1377,6 +1378,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). vasnprintf vasprintf vasprintf_r + versionsort wcsftime_l wcstod_l wcstof_l