zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Fix exit status of zmodload -R
@ 2005-08-08 18:24 Thorsten Dahlheimer
  0 siblings, 0 replies; only message in thread
From: Thorsten Dahlheimer @ 2005-08-08 18:24 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

If zmodload -R fails because the specified module is not an alias,
it returns status 0:

    % zmodload -R zsh/main
    zmodload: module is not an alias: zsh/main
    % echo $?
    0

A fix is attached.

Regards,
Thorsten Dahlheimer

[-- Attachment #2: zmodload.patch --]
[-- Type: application/octet-stream, Size: 1006 bytes --]

Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.18
diff -u -p -r1.18 module.c
--- Src/module.c	20 Jul 2005 16:08:22 -0000	1.18
+++ Src/module.c	8 Aug 2005 14:46:27 -0000
@@ -1043,7 +1043,6 @@ bin_zmodload_alias(char *nam, char **arg
      */
     LinkNode node;
     Module m;
-    int ret = 0;
 
     if (!*args) {
 	if (OPT_ISSET(ops,'R')) {
@@ -1058,7 +1057,7 @@ bin_zmodload_alias(char *nam, char **arg
 	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 **arg
 		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 {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-08 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-08 18:24 PATCH: Fix exit status of zmodload -R Thorsten Dahlheimer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).