about summary refs log tree commit diff
path: root/Src/module.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-04-19 16:09:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-04-19 16:09:06 +0000
commitb7474e065b82d930f8da472440282ea7654d491d (patch)
tree07ae2866628b6fd4f180824d566de06be94796ed /Src/module.c
parent5c2d5b013e1d8cab43ca19507bf669693c95cd95 (diff)
downloadzsh-b7474e065b82d930f8da472440282ea7654d491d.tar.gz
zsh-b7474e065b82d930f8da472440282ea7654d491d.tar.xz
zsh-b7474e065b82d930f8da472440282ea7654d491d.zip
22416, tweaked: math functions via shell functions
unposted: add styles to pick-web-browser
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/module.c b/Src/module.c
index 17daffc2d..de3fd9932 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1384,7 +1384,7 @@ bin_zmodload_math(char *nam, char **args, Options ops)
 	MathFunc p;
 
 	for (p = mathfuncs; p; p = p->next) {
-	    if (p->module) {
+	    if (!(p->flags & MFF_USERFUNC) && p->module) {
 		if (OPT_ISSET(ops,'L')) {
 		    fputs("zmodload -af", stdout);
 		    printf(" %s %s\n", p->module, p->name);
@@ -2085,7 +2085,8 @@ add_autoparam(char *nam, char *module)
 MathFunc mathfuncs;
 
 /**/
-static void removemathfunc(MathFunc previous, MathFunc current)
+void
+removemathfunc(MathFunc previous, MathFunc current)
 {
     if (previous)
 	previous->next = current->next;
@@ -2105,7 +2106,7 @@ getmathfunc(char *name, int autol)
 
     for (p = mathfuncs; p; q = p, p = p->next)
 	if (!strcmp(name, p->name)) {
-	    if (autol && p->module) {
+	    if (autol && p->module && !(p->flags & MFF_USERFUNC)) {
 		char *n = dupstring(p->module);
 
 		removemathfunc(q, p);
@@ -2131,7 +2132,7 @@ addmathfunc(MathFunc f)
 
     for (p = mathfuncs; p; q = p, p = p->next)
 	if (!strcmp(f->name, p->name)) {
-	    if (p->module) {
+	    if (p->module && !(p->flags & MFF_USERFUNC)) {
 		/*
 		 * Autoloadable, replace.
 		 */
@@ -2206,6 +2207,7 @@ deletemathfunc(MathFunc f)
 	else
 	    mathfuncs = f->next;
 
+	/* the following applies to both unloaded and user-defined functions */
 	if (f->module) {
 	    zsfree(f->name);
 	    zsfree(f->module);