about summary refs log tree commit diff
path: root/Src/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/Src/module.c b/Src/module.c
index 09f1fd5db..c966d4497 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -142,6 +142,7 @@ addwrapper(Module m, FuncWrap w)
     return 0;
 }
 
+/**/
 #ifdef DYNAMIC
 
 /* $module_path ($MODULE_PATH) */
@@ -238,6 +239,7 @@ deletewrapper(Module m, FuncWrap w)
     return 1;
 }
 
+/**/
 #ifdef AIXDYNAMIC
 
 #include <sys/ldr.h>
@@ -273,6 +275,7 @@ load_and_bind(const char *fn)
 #define dlclose(X)  unload(X)
 #define dlerror()   (dlerrstr[0])
 
+/**/
 #else
 
 #ifdef HAVE_DLFCN_H
@@ -289,6 +292,7 @@ load_and_bind(const char *fn)
 # endif
 #endif
 
+/**/
 #ifdef HPUXDYNAMIC
 # define dlopen(file,mode) (void *)shl_load((file), (mode), (long) 0)
 # define dlclose(handle) shl_unload((shl_t)(handle))
@@ -309,6 +313,7 @@ hpux_dlsym(void *handle, char *name)
 # ifndef HAVE_DLCLOSE
 #  define dlclose(X) ((X), 0)
 # endif
+/**/
 #endif
 
 #ifdef DLSYM_NEEDS_UNDERSCORE
@@ -331,6 +336,7 @@ hpux_dlsym(void *handle, char *name)
 # define STR_FINISH_S  "finish_%s"
 #endif /* !DLSYM_NEEDS_UNDERSCORE */
 
+/**/
 #endif /* !AIXDYNAMIC */
 
 #ifndef RTLD_LAZY
@@ -408,6 +414,7 @@ find_module(const char *name)
     return NULL;
 }
 
+/**/
 #ifdef AIXDYNAMIC
 
 /**/
@@ -438,6 +445,7 @@ finish_module(Module m)
     return ((int (*)_((int,Module))) m->handle)(3, m);
 }
 
+/**/
 #else
 
 static Module_func
@@ -523,6 +531,7 @@ finish_module(Module m)
     return r;
 }
 
+/**/
 #endif /* !AIXDYNAMIC */
 
 /**/
@@ -664,7 +673,7 @@ autoloadscan(HashNode hn, int printflags)
     if(bn->flags & BINF_ADDED)
 	return;
     if(printflags & PRINT_LIST) {
-	fputs("zmodload -a ", stdout);
+	fputs("zmodload -ab ", stdout);
 	if(bn->optstr[0] == '-')
 	    fputs("-- ", stdout);
 	quotedzputs(bn->optstr, stdout);
@@ -687,7 +696,12 @@ autoloadscan(HashNode hn, int printflags)
 int
 bin_zmodload(char *nam, char **args, char *ops, int func)
 {
-    if(ops['d'] && ops['a']) {
+    if ((ops['b'] || ops['c'] || ops['p']) && !(ops['a'] || ops['u'])) {
+	zwarnnam(nam, "-b, -c, and -p must be combined with -a or -u",
+		 NULL, 0);
+	return 1;
+    }
+    if (ops['d'] && ops['a']) {
 	zwarnnam(nam, "-d cannot be combined with -a", NULL, 0);
 	return 1;
     }
@@ -695,16 +709,20 @@ bin_zmodload(char *nam, char **args, char *ops, int func)
 	zwarnnam(nam, "what do you want to unload?", NULL, 0);
 	return 1;
     }
-    if(ops['d'])
+    if (ops['d'])
 	return bin_zmodload_dep(nam, args, ops);
-    else if(ops['a'])
+    else if ((ops['a'] || ops['b']) && !(ops['c'] || ops['p']))
 	return bin_zmodload_auto(nam, args, ops);
-    else if (ops['c'] || ops['C'])
+    else if (ops['c'] && !(ops['b'] || ops['p']))
 	return bin_zmodload_cond(nam, args, ops);
-    else if (ops['p'])
+    else if (ops['p'] && !(ops['b'] || ops['c']))
 	return bin_zmodload_param(nam, args, ops);
-    else
+    else if (!(ops['a'] || ops['b'] || ops['c'] || ops['p']))
 	return bin_zmodload_load(nam, args, ops);
+    else
+	zwarnnam(nam, "use only one of -b, -c, or -p", NULL, 0);
+
+    return 1;
 }
 
 /**/
@@ -865,7 +883,7 @@ bin_zmodload_cond(char *nam, char **args, char *ops)
 	for (p = condtab; p; p = p->next) {
 	    if (p->module) {
 		if (ops['L']) {
-		    fputs("zmodload -c", stdout);
+		    fputs("zmodload -ac", stdout);
 		    if (p->flags & CONDF_INFIX)
 			putchar('I');
 		    printf(" %s %s\n", p->module, p->name);
@@ -908,7 +926,7 @@ printautoparams(HashNode hn, int lon)
 
     if (pm->flags & PM_AUTOLOAD) {
 	if (lon)
-	    printf("zmodload -p %s %s\n", pm->u.str, pm->nam);
+	    printf("zmodload -ap %s %s\n", pm->u.str, pm->nam);
 	else
 	    printf("%s (%s)\n", pm->nam, pm->u.str);
     }
@@ -1097,6 +1115,7 @@ bin_zmodload_load(char *nam, char **args, char *ops)
     }
 }
 
+/**/
 #endif /* DYNAMIC */
 
 /* The list of module-defined conditions. */
@@ -1252,6 +1271,7 @@ deleteparamdefs(char const *nam, Paramdef d, int size)
     return 1;
 }
 
+/**/
 #ifdef DYNAMIC
 
 /* This adds a definition for autoloading a module for a condition. */
@@ -1342,4 +1362,5 @@ add_autoparam(char *nam, char *module)
     pm->flags |= PM_AUTOLOAD;
 }
 
+/**/
 #endif