From 8afeda3a80aa5c8cd6516c9d5db27f89784e6e74 Mon Sep 17 00:00:00 2001 From: ellson Date: Mon, 14 Apr 2008 16:35:16 +0000 Subject: [PATCH] support GVBINDIR env var on all platforms - per request and patch from: Marcel Partap --- lib/gvc/gvconfig.c | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c index 350ee7caf..e6ce944b9 100644 --- a/lib/gvc/gvconfig.c +++ b/lib/gvc/gvconfig.c @@ -273,9 +273,9 @@ char * gvconfig_libdir(void) FILE *f; if (!libdir) { -#ifdef WIN32 libdir=getenv("GVBINDIR"); if (!libdir) { +#ifdef WIN32 int r; char* s; HMODULE hm = GetModuleHandle (NULL); @@ -295,35 +295,35 @@ char * gvconfig_libdir(void) } *s = '\0'; libdir = line; - } #else - /* this only works on linux, other systems will get GVLIBDIR only */ - libdir = GVLIBDIR; - f = fopen ("/proc/self/maps", "r"); - if (f) { - while (!feof (f)) { - if (!fgets (line, sizeof (line), f)) - continue; - if (!strstr (line, " r-xp ")) - continue; - path = strchr (line, '/'); - if (!path) - continue; - tmp = strstr (path, "/libgvc."); - if (tmp) { - *tmp = 0; - /* Check for real /lib dir. Don't accept pre-install /.libs */ - if (strcmp(strrchr(path,'/'), "/.libs") == 0) + /* this only works on linux, other systems will get GVLIBDIR only */ + libdir = GVLIBDIR; + f = fopen ("/proc/self/maps", "r"); + if (f) { + while (!feof (f)) { + if (!fgets (line, sizeof (line), f)) continue; - strcpy(line, path); /* use line buffer for result */ - strcat(line, "/graphviz"); /* plugins are in "graphviz" subdirectory */ - libdir = line; - break; - } - } - fclose (f); - } + if (!strstr (line, " r-xp ")) + continue; + path = strchr (line, '/'); + if (!path) + continue; + tmp = strstr (path, "/libgvc."); + if (tmp) { + *tmp = 0; + /* Check for real /lib dir. Don't accept pre-install /.libs */ + if (strcmp(strrchr(path,'/'), "/.libs") == 0) + continue; + strcpy(line, path); /* use line buffer for result */ + strcat(line, "/graphviz"); /* plugins are in "graphviz" subdirectory */ + libdir = line; + break; + } + } + fclose (f); + } #endif + } } return libdir; } -- 2.40.0