From c426897f56d845154764d60af0d5990a1b0b62cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 Nov 2004 14:24:10 +0000 Subject: [PATCH] Changed to make use of environment variables if present. I think we'll later should cut down on the defaults. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9763 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/apps/rld/rldelf.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/kernel/apps/rld/rldelf.c b/src/kernel/apps/rld/rldelf.c index a3a2b8119e..622cda02a6 100644 --- a/src/kernel/apps/rld/rldelf.c +++ b/src/kernel/apps/rld/rldelf.c @@ -829,16 +829,36 @@ register_image(image_t *image, int fd, const char *path) static const char * search_path_for_type(image_type type) { + const char *path = NULL; + switch (type) { + case B_APP_IMAGE: + path = getenv("PATH"); + break; + case B_LIBRARY_IMAGE: + path = getenv("LIBRARY_PATH"); + break; + case B_ADD_ON_IMAGE: + path = getenv("ADDON_PATH"); + break; + + default: + return NULL; #if 0 - // ToDo: note, the getenv() call is not yet part of rld.so case B_APP_IMAGE: return getenv("PATH"); case B_LIBRARY_IMAGE: return getenv("LIBRARY_PATH"); case B_ADD_ON_IMAGE: return getenv("ADDON_PATH"); -#else +#endif + } + + // ToDo: for now, if the variable was not set, return default paths + if (path != NULL) + return path; + + switch(type) { case B_APP_IMAGE: return "/boot/home/config/bin:" "/bin:" @@ -853,7 +873,7 @@ search_path_for_type(image_type type) case B_ADD_ON_IMAGE: return "%A/lib:/boot/home/config/lib:/boot/beos/system/lib"; -#endif + default: return NULL; }