bug 283475 - launching on solaris 9
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseMozilla.c b/bundles/org.eclipse.equinox.executable/library/eclipseMozilla.c
index 25035ff..45a01d6 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseMozilla.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseMozilla.c
@@ -91,6 +91,40 @@
return 0; /* exclude from scandir result */
}
+#if defined (SOLARIS)
+/*
+ * A replacement for
+ * scandir(const char *dir, struct dirent ***namelist, filter, alphasort);
+ * because scandir & alphasort don't exist on Solaris 9.
+ * Return the dirent->d_name that was sorted the highest according to strcoll,
+ * or NULL on error or if no entries matched the filter.
+ * The caller is responsible for freeing the returned string
+ */
+char * scan(const char * path) {
+ DIR *dir = NULL;
+ struct dirent * entry = NULL;
+ char * candidate = NULL;
+
+ if ((dir = opendir(path)) == NULL) {
+ return NULL;
+ }
+
+ while ((entry = readdir(dir)) != NULL) {
+ if (filter(entry)) {
+ if (candidate == NULL) {
+ candidate = strdup(entry->d_name);
+ } else if (strcoll(candidate, entry->d_name) < 0) {
+ free(candidate);
+ candidate = strdup(entry->d_name);
+ }
+ }
+ }
+ closedir(dir);
+
+ return candidate;
+}
+#endif
+
/* Set the environmnent required by the SWT Browser widget to bind to Mozilla.
* The SWT Browser widget relies on Mozilla on Linux. The LD_LIBRARY_PATH
* and the Mozilla environment variable MOZILLA_FIVE_HOME must point
@@ -172,6 +206,10 @@
#else
char* dir = "/usr/lib/";
#endif
+#if defined (SOLARIS)
+ char * name = scan(dir);
+ if (name != NULL) {
+#else
struct dirent **namelist;
int i;
int count = scandir(dir, &namelist, filter, alphasort);
@@ -181,13 +219,18 @@
* with the latest version number.
*/
char* name = namelist [count - 1]->d_name;
+#endif
grePath = malloc (strlen(dir) + strlen(name) + 1);
strcpy(grePath, dir);
strcat(grePath, name);
+#if defined (SOLARIS)
+ free(name);
+#else
for (i = 0; i < count; i++) {
free(namelist [i]);
}
free(namelist);
+#endif
}
if (grePath == NULL)
diff --git a/bundles/org.eclipse.equinox.launcher/contributed/org.eclipse.equinox.launcher.gtk.solaris.x86/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.launcher/contributed/org.eclipse.equinox.launcher.gtk.solaris.x86/META-INF/MANIFEST.MF
index be1e9db..ad02a5d 100644
--- a/bundles/org.eclipse.equinox.launcher/contributed/org.eclipse.equinox.launcher.gtk.solaris.x86/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.launcher/contributed/org.eclipse.equinox.launcher.gtk.solaris.x86/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.solaris.x86;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.201.qualifier
Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.1.0)"
Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch=x86))
Bundle-Localization: launcher.gtk.solaris.x86
diff --git a/bundles/org.eclipse.equinox.launcher/fragments/org.eclipse.equinox.launcher.gtk.solaris.sparc/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.launcher/fragments/org.eclipse.equinox.launcher.gtk.solaris.sparc/META-INF/MANIFEST.MF
index cceedfb..73431fd 100644
--- a/bundles/org.eclipse.equinox.launcher/fragments/org.eclipse.equinox.launcher.gtk.solaris.sparc/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.launcher/fragments/org.eclipse.equinox.launcher.gtk.solaris.sparc/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.solaris.sparc;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.0.201.qualifier
Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.1.0)"
Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch=sparc))
Bundle-Localization: launcher.gtk.solaris.sparc