aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/cmd.c b/cmd.c
index 45ca1c0..5460f96 100644
--- a/cmd.c
+++ b/cmd.c
@@ -228,14 +228,26 @@ static void cmd_module __P1 (char *,arg) {
void *lib;
void (*func)();
+ int pindex;
+ struct stat junk;
+ char *prefixes[] = {
+ "./",
+ "/lib/powwow",
+ "/usr/lib/powwow",
+ "/usr/local/lib/powwow",
+ "$HOME/.powwow/lib" /* this doesn't work, but is here to remind me :p */
+ };
+
arg = skipspace(arg);
- bzero( libname, 1024 );
- if( *arg == '.' || *arg == '/' ) {
- /* No path mungling */
- strncpy( libname, arg, 1024 );
- }else{
- snprintf( libname, 1024, "/usr/local/lib/powwow/%s", arg );
+ /* I changed it to work this way so that you can have libs in multiple places and
+ * also eventually to allow it to use .dll instead of .so under the cygwin environment */
+ for( pindex = 0; pindex < 4; pindex++ ) {
+ bzero( libname, 1024 );
+ snprintf( libname, 1024, "%s/%s.so", prefixes[ pindex ], arg );
+ if( stat( libname, &junk ) == 0 ) {
+ break;
+ }
}
/* open lib */