summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-06-12 10:10:23 +0100
committerPeter Stephenson <pws@zsh.org>2017-06-12 10:10:23 +0100
commitd5c22d356ba442fd5811e15cc35b5480008722f4 (patch)
treee99b29c9920f83da25e4c3bbb48409e83f73ffae /Src
parent18aede9ee53df5e83c786e4fd81872df864dcd47 (diff)
downloadzsh-d5c22d356ba442fd5811e15cc35b5480008722f4.tar.gz
zsh-d5c22d356ba442fd5811e15cc35b5480008722f4.tar.xz
zsh-d5c22d356ba442fd5811e15cc35b5480008722f4.zip
41244: Add zmodload -s option.
Doesn't complain if module is unavailable, but prints more
obscure errors.

Use existing low-level silent flag by passing through
intermediate module loading hierarchy.
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/zftp.c2
-rw-r--r--Src/Zle/zle_thingy.c2
-rw-r--r--Src/builtin.c2
-rw-r--r--Src/module.c12
4 files changed, 9 insertions, 9 deletions
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index deed35e2f..24f4b4200 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -3177,7 +3177,7 @@ static struct features module_features = {
 int
 setup_(UNUSED(Module m))
 {
-    return (require_module("zsh/net/tcp", NULL) == 1);
+    return (require_module("zsh/net/tcp", NULL, 0) == 1);
 }
 
 /**/
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index c003148f8..f7e9829c2 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -602,7 +602,7 @@ bin_zle_complete(char *name, char **args, UNUSED(Options ops), UNUSED(char func)
     Thingy t;
     Widget w, cw;
 
-    if (require_module("zsh/complete", NULL) == 1) {
+    if (require_module("zsh/complete", NULL, 0) == 1) {
 	zwarnnam(name, "can't load complete module");
 	return 1;
     }
diff --git a/Src/builtin.c b/Src/builtin.c
index 063644efb..0b3949437 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -131,7 +131,7 @@ static struct builtin builtins[] =
     BUILTIN("whence", 0, bin_whence, 0, -1, 0, "acmpvfsSwx:", NULL),
     BUILTIN("where", 0, bin_whence, 0, -1, 0, "pmsSwx:", "ca"),
     BUILTIN("which", 0, bin_whence, 0, -1, 0, "ampsSwx:", "c"),
-    BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "AFRILP:abcfdilmpue", NULL),
+    BUILTIN("zmodload", 0, bin_zmodload, 0, -1, 0, "AFRILP:abcfdilmpsue", NULL),
     BUILTIN("zcompile", 0, bin_zcompile, 0, -1, 0, "tUMRcmzka", NULL),
 };
 
diff --git a/Src/module.c b/Src/module.c
index 41f142adb..21d68b1ac 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -2326,7 +2326,7 @@ load_module(char const *name, Feature_enables enablesarr, int silent)
 
 /**/
 mod_export int
-require_module(const char *module, Feature_enables features)
+require_module(const char *module, Feature_enables features, int silent)
 {
     Module m = NULL;
     int ret = 0;
@@ -2336,7 +2336,7 @@ require_module(const char *module, Feature_enables features)
     m = find_module(module, FINDMOD_ALIASP, &module);
     if (!m || !m->u.handle ||
 	(m->node.flags & MOD_UNLOAD))
-	ret = load_module(module, features, 0);
+	ret = load_module(module, features, silent);
     else
 	ret = do_module_features(m, features, 0);
     unqueue_signals();
@@ -2972,7 +2972,7 @@ bin_zmodload_load(char *nam, char **args, Options ops)
     } else {
 	/* load modules */
 	for (; *args; args++) {
-	    int tmpret = require_module(*args, NULL);
+	    int tmpret = require_module(*args, NULL, OPT_ISSET(ops,'s'));
 	    if (tmpret && ret != 1)
 		ret = tmpret;
 	}
@@ -3242,7 +3242,7 @@ bin_zmodload_features(const char *nam, char **args, Options ops)
     fep->str = NULL;
     fep->pat = NULL;
 
-    return require_module(modname, features);
+    return require_module(modname, features, OPT_ISSET(ops,'s'));
 }
 
 
@@ -3403,14 +3403,14 @@ ensurefeature(const char *modname, const char *prefix, const char *feature)
     struct feature_enables features[2];
 
     if (!feature)
-	return require_module(modname, NULL);
+	return require_module(modname, NULL, 0);
     f = dyncat(prefix, feature);
 
     features[0].str = f;
     features[0].pat = NULL;
     features[1].str = NULL;
     features[1].pat = NULL;
-    return require_module(modname, features);
+    return require_module(modname, features, 0);
 }
 
 /*