summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch2/Util.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-06-27 22:57:05 +0000
committerBernard Normier <bernard@zeroc.com>2006-06-27 22:57:05 +0000
commit1df2416659d57130b79a83081a18e8e96bc278c2 (patch)
tree4b92e0cca9129514da1554de8fce34982f0eb9c0 /cpp/src/IcePatch2/Util.cpp
parentFixed bug 1138 (diff)
downloadice-1df2416659d57130b79a83081a18e8e96bc278c2.tar.bz2
ice-1df2416659d57130b79a83081a18e8e96bc278c2.tar.xz
ice-1df2416659d57130b79a83081a18e8e96bc278c2.zip
Renamed Sun's scandir and isalphasort to ice_scandir and ice_isalphasort
Diffstat (limited to 'cpp/src/IcePatch2/Util.cpp')
-rw-r--r--cpp/src/IcePatch2/Util.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp
index 20c80f713cd..b16203054fa 100644
--- a/cpp/src/IcePatch2/Util.cpp
+++ b/cpp/src/IcePatch2/Util.cpp
@@ -34,15 +34,12 @@ const char* IcePatch2::checksumFile = "IcePatch2.sum";
const char* IcePatch2::logFile = "IcePatch2.log";
//
-// Sun-OS doesn't have scandir() or alphasort().
+// Solaris 9 and before doesn't have scandir() or alphasort().
//
#ifdef __sun
-extern "C"
-{
-
-static int
-scandir(const char* dir, struct dirent*** namelist,
+extern "C" static int
+ice_scandir(const char* dir, struct dirent*** namelist,
int (*select)(const struct dirent*),
int (*compar)(const void*, const void*))
{
@@ -98,16 +95,14 @@ scandir(const char* dir, struct dirent*** namelist,
return i;
}
-static int
-alphasort(const void* v1, const void* v2)
+extern "C" static int
+ice_alphasort(const void* v1, const void* v2)
{
const struct dirent **a = (const struct dirent **)v1;
const struct dirent **b = (const struct dirent **)v2;
return(strcmp((*a)->d_name, (*b)->d_name));
}
-}
-
#endif
using namespace std;
@@ -559,7 +554,11 @@ IcePatch2::readDirectory(const string& pa)
#else
struct dirent **namelist;
+#ifdef __sun
+ int n = ice_scandir(path.c_str(), &namelist, 0, ice_alphasort);
+#else
int n = scandir(path.c_str(), &namelist, 0, alphasort);
+#endif
if(n < 0)
{
throw "cannot read directory `" + path + "':\n" + lastError();