about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-06-14 11:57:08 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-06-14 11:57:08 +0000
commite6f14352d61721db83b46e0e56c4d19b731fed95 (patch)
tree7bf7741f5c63b956dde1bfbbdc2da8d587ce2a7d /Src
parent4af11dc57a6f3d1c8f0ed412f6f11cf835edcf4e (diff)
downloadzsh-e6f14352d61721db83b46e0e56c4d19b731fed95.tar.gz
zsh-e6f14352d61721db83b46e0e56c4d19b731fed95.tar.xz
zsh-e6f14352d61721db83b46e0e56c4d19b731fed95.zip
28037: improved error messages for module autoloads
of math functions and builtins
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c6
-rw-r--r--Src/math.c3
-rw-r--r--Src/module.c5
3 files changed, 10 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 8fd52420b..6611e9c79 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2274,18 +2274,20 @@ static HashNode
 resolvebuiltin(const char *cmdarg, HashNode hn)
 {
     if (!((Builtin) hn)->handlerfunc) {
+	char *modname = dupstring(((Builtin) hn)->optstr);
 	/*
 	 * Ensure the module is loaded and the
 	 * feature corresponding to the builtin
 	 * is enabled.
 	 */
-	(void)ensurefeature(((Builtin) hn)->optstr, "b:",
+	(void)ensurefeature(modname, "b:",
 			    (hn->flags & BINF_AUTOALL) ? NULL :
 			    hn->nam);
 	hn = builtintab->getnode(builtintab, cmdarg);
 	if (!hn) {
 	    lastval = 1;
-	    zerr("unknown builtin: %s", cmdarg);
+	    zerr("autoloading module %s failed to define builtin: %s",
+		 modname, cmdarg);
 	    return NULL;
 	}
     }
diff --git a/Src/math.c b/Src/math.c
index a19c8c762..caff06de9 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -941,8 +941,9 @@ callmathfunc(char *o)
 		    zerr("wrong number of arguments: %s", o);
 	    }
 	}
-    } else
+    } else {
 	zerr("unknown function: %s", n);
+    }
 
     dummy.type = MN_INTEGER;
     dummy.u.l = 0;
diff --git a/Src/module.c b/Src/module.c
index 4f71153b7..219bdfa8e 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1273,7 +1273,10 @@ getmathfunc(const char *name, int autol)
 		(void)ensurefeature(n, "f:", (flags & MFF_AUTOALL) ? NULL :
 				    name);
 
-		return getmathfunc(name, 0);
+	       p = getmathfunc(name, 0);
+	       if (!p) {
+		   zerr("autoloading module %s failed to define math function: %s", n, name);
+	       }
 	    }
 	    return p;
 	}