summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--Src/Zle/zle_main.c13
-rw-r--r--Src/mkmakemod.sh8
-rw-r--r--Src/module.c21
4 files changed, 37 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 120987be1..6bffc7043 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-08-09  Peter Stephenson  <pws@csr.com>
 
+	* 21583: Thorsten Dahlheimer: Src/module.c: extend circularity
+	test of zmodload -A.
+
+	* 21582: Thorsten Dahlheimer: Src/module.c: failure status of
+	zmodload -R was wrong.
+
+	* 21578: Thorsten Dahlheimer: Src/mkmakemod.sh: script used not
+	to exit after cleaning up.
+
 	* 21577 (adapted): Dan Bullok: Src/Zle/zle_main.c, Src/init.c,
 	Src/utils.c: improved 21567 which reexpands the prompt and
 	refreshes but doesn't trash the line editor.
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index e6f83cb3e..1acff3bbb 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1481,6 +1481,17 @@ resetprompt(UNUSED(char **args))
     return redisplay(NULL);
 }
 
+/* same bug called from outside zle */
+
+/**/
+mod_export void
+zle_resetprompt(void)
+{   reexpandprompt();
+    if (zleactive)
+        redisplay(NULL);
+}
+
+
 /**/
 mod_export void
 trashzle(void)
@@ -1572,6 +1583,7 @@ setup_(UNUSED(Module m))
 {
     /* Set up editor entry points */
     trashzleptr = trashzle;
+    zle_resetpromptptr = zle_resetprompt;
     zrefreshptr = zrefresh;
     zleaddtolineptr = zleaddtoline;
     zlegetlineptr = zlegetline;
@@ -1659,6 +1671,7 @@ finish_(UNUSED(Module m))
 
     /* editor entry points */
     trashzleptr = noop_function;
+    zle_resetpromptptr = noop_function;
     zrefreshptr = noop_function;
     zleaddtolineptr = noop_function_int;
     zlegetlineptr = NULL;
diff --git a/Src/mkmakemod.sh b/Src/mkmakemod.sh
index 38c5e72e1..e67b7a7a8 100644
--- a/Src/mkmakemod.sh
+++ b/Src/mkmakemod.sh
@@ -37,7 +37,7 @@
 # `:<<\Make' and `Make' -- this will be copied into Makemod.in.
 #
 # The resulting Makemod.in knows how to build each module that is defined.
-# For each module in also knows how to build a .mdh file.  Each source file
+# For each module it also knows how to build a .mdh file.  Each source file
 # should #include the .mdh file for the module it is a part of.  The .mdh
 # file #includes the .mdh files for any module dependencies, then each of
 # $headers, and then each .epro (for global declarations).  It will
@@ -92,7 +92,7 @@ if $first_stage; then
 
     dir_top=`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
 
-    trap "rm -f $the_subdir/${the_makefile}.in" 1 2 15
+    trap "rm -f $the_subdir/${the_makefile}.in; exit 1" 1 2 15
     echo "creating $the_subdir/${the_makefile}.in"
     exec 3>&1 >$the_subdir/${the_makefile}.in
     echo "##### ${the_makefile}.in generated automatically by mkmakemod.sh"
@@ -466,11 +466,11 @@ if $first_stage; then
 fi
 
 if $second_stage ; then
-    trap "rm -f $the_subdir/${the_makefile}" 1 2 15
+    trap "rm -f $the_subdir/${the_makefile}; exit 1" 1 2 15
 
     ${CONFIG_SHELL-/bin/sh} ./config.status \
 	--file=$the_subdir/${the_makefile}:$the_subdir/${the_makefile}.in ||
-    return 1
+    exit 1
 fi
 
 exit 0
diff --git a/Src/module.c b/Src/module.c
index 7a0fcf811..ee493ad0c 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1043,7 +1043,6 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
      */
     LinkNode node;
     Module m;
-    int ret = 0;
 
     if (!*args) {
 	if (OPT_ISSET(ops,'R')) {
@@ -1058,7 +1057,7 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
 	return 0;
     }
 
-    for (; !ret && *args; args++) {
+    for (; *args; args++) {
 	char *eqpos = strchr(*args, '=');
 	char *aliasname = eqpos ? eqpos+1 : NULL;
 	if (eqpos)
@@ -1078,8 +1077,7 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
 		m = (Module) getdata(node);
 		if (!(m->flags & MOD_ALIAS)) {
 		    zwarnnam(nam, "module is not an alias: %s", *args, 0);
-		    ret = 1;
-		    break;
+		    return 1;
 		}
 		delete_module(node);
 	    } else {
@@ -1093,12 +1091,15 @@ bin_zmodload_alias(char *nam, char **args, Options ops)
 		    zwarnnam(nam, "invalid module name `%s'", aliasname, 0);
 		    return 1;
 		}
-		find_module(aliasname, 1, &mname);
-		if (!strcmp(mname, *args)) {
-		    zwarnnam(nam, "module alias would refer to itself: %s",
-			     *args, 0);
-		    return 1;
-		}
+		do {
+		    if (!strcmp(mname, *args)) {
+			zwarnnam(nam, "module alias would refer to itself: %s",
+				 *args, 0);
+			return 1;
+		    }
+		} while ((node = find_module(mname, 0, NULL))
+			 && ((m = (Module) getdata(node))->flags & MOD_ALIAS)
+			 && (mname = m->u.alias));
 		node = find_module(*args, 0, NULL);
 		if (node) {
 		    m = (Module) getdata(node);