c7f2575cac
okay maintainer.
68 lines
1.5 KiB
Plaintext
68 lines
1.5 KiB
Plaintext
$OpenBSD: patch-src_my_glade_c,v 1.2 2002/06/15 23:53:50 espie Exp $
|
|
|
|
--- src/my_glade.c.orig Sun Dec 16 18:50:08 2001
|
|
+++ src/my_glade.c Sun Jun 16 01:13:28 2002
|
|
@@ -48,6 +48,51 @@ static void *my_dlsym(void *handle, char
|
|
return fun;
|
|
}
|
|
|
|
+#ifdef __OpenBSD__
|
|
+#include <string.h>
|
|
+#include <dirent.h>
|
|
+#include <libgen.h>
|
|
+/* Quick and dirty: settle for any libglade */
|
|
+static void *findlibrary(char *template)
|
|
+{
|
|
+ char *name;
|
|
+ char *sopart;
|
|
+ size_t len;
|
|
+ DIR *d;
|
|
+ struct dirent *de;
|
|
+ void *lib;
|
|
+
|
|
+ name = dirname(template);
|
|
+ if (!name)
|
|
+ return NULL;
|
|
+ template = basename(template);
|
|
+ if (!template)
|
|
+ return NULL;
|
|
+ sopart = strstr(template, ".so.");
|
|
+ if (!sopart)
|
|
+ return NULL;
|
|
+
|
|
+ len = sopart-template+4;
|
|
+
|
|
+ d = opendir(name);
|
|
+ if (!d)
|
|
+ return NULL;
|
|
+ while ((de = readdir(d)) != NULL) {
|
|
+ if (strncmp(de->d_name, template, len) == 0) {
|
|
+ lib = dlopen(de->d_name, DL_LAZY);
|
|
+ closedir(d);
|
|
+ return lib;
|
|
+ }
|
|
+ }
|
|
+ closedir(d);
|
|
+ return NULL;
|
|
+}
|
|
+#endif
|
|
+
|
|
+#ifndef RTLD_NOW
|
|
+#define RTLD_NOW 0
|
|
+#endif
|
|
+
|
|
// to be called first
|
|
void my_glade_setup ()
|
|
{
|
|
@@ -60,6 +105,10 @@ void my_glade_setup ()
|
|
// next, try without path
|
|
glade_lib = dlopen (LIBGLADE_LIB, RTLD_NOW);
|
|
}
|
|
+#ifdef __OpenBSD__
|
|
+ if (glade_lib == NULL)
|
|
+ glade_lib = findlibrary(LIBGLADE_LIBDIR "/" LIBGLADE_LIB);
|
|
+#endif
|
|
if (glade_lib == NULL) {
|
|
fprintf(stderr, "Error during dlopen: %s\n", dlerror());
|
|
gtk_exit(1);
|