aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2005-03-12 00:41:19 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2005-03-12 00:41:19 (GMT)
commit2e5aae98ffdcae5477fc2026fc030bbacd3f70db (patch)
tree7c2dc9bf8c5f8120bf716d9b8a91bc622756084c /cmd.c
parent77b250bfb63a28a8fe8a8da67de7354bce6e61ff (diff)
downloadpowwow-2e5aae98ffdcae5477fc2026fc030bbacd3f70db.zip
powwow-2e5aae98ffdcae5477fc2026fc030bbacd3f70db.tar.gz
powwow-2e5aae98ffdcae5477fc2026fc030bbacd3f70db.tar.bz2
Changed the #module command to handle searching multiple (currently compiled in)
library paths, and remove the requirement for the .so part of the filename so that in future versions we can support .dll under cygwin
Diffstat (limited to 'cmd.c')
-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 */