From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3146 invoked from network); 27 Mar 2000 11:28:13 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Mar 2000 11:28:13 -0000 Received: (qmail 2215 invoked by alias); 27 Mar 2000 11:27:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10275 Received: (qmail 2196 invoked from network); 27 Mar 2000 11:27:57 -0000 Date: Mon, 27 Mar 2000 13:27:55 +0200 (MET DST) Message-Id: <200003271127.NAA05593@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Sven Wischnowsky's message of Mon, 27 Mar 2000 12:49:28 +0200 (MET DST) Subject: Re: autoload +X[zk] Sorrysorrysorry, just found a bug in this patch. Bye Sven diff -ru ../z.old/Src/builtin.c Src/builtin.c --- ../z.old/Src/builtin.c Mon Mar 27 13:05:36 2000 +++ Src/builtin.c Mon Mar 27 13:21:31 2000 @@ -2016,7 +2016,7 @@ return bin_eval(name, fargv, ops, func); } - return loadautofn(shf, (ops['k'] ? 2 : (ops['z'] ? 0 : 1))); + return !loadautofn(shf, (ops['k'] ? 2 : (ops['z'] ? 0 : 1))); } /* Display or change the attributes of shell functions. * diff -ru ../z.old/Src/exec.c Src/exec.c --- ../z.old/Src/exec.c Mon Mar 27 13:05:36 2000 +++ Src/exec.c Mon Mar 27 13:25:21 2000 @@ -3166,16 +3166,17 @@ static int execautofn(Estate state, int do_exec) { - if (loadautofn(state->prog->shf, 1)) - return 1; + Shfunc shf; + if (!(shf = loadautofn(state->prog->shf, 1))) + return 1; - execode(state->prog->shf->funcdef, 1, 0); + execode(shf->funcdef, 1, 0); return lastval; } /**/ -int +Shfunc loadautofn(Shfunc shf, int fksh) { int noalias = noaliases, ksh = 1; @@ -3193,7 +3194,7 @@ if (prog == &dummy_eprog) { zerr("%s: function definition file not found", shf->nam, 0); popheap(); - return 1; + return NULL; } if (!prog) prog = &dummy_eprog; @@ -3202,10 +3203,10 @@ strcpy(n, shf->nam); execode(prog, 1, 0); shf = (Shfunc) shfunctab->getnode(shfunctab, n); - if(!shf || (shf->flags & PM_UNDEFINED)) { + if (!shf || (shf->flags & PM_UNDEFINED)) { zerr("%s: function not defined by file", n, 0); popheap(); - return 1; + return NULL; } } else { freeeprog(shf->funcdef); @@ -3217,7 +3218,7 @@ } popheap(); - return 0; + return shf; } /* execute a shell function */ -- Sven Wischnowsky wischnow@informatik.hu-berlin.de