From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27149 invoked from network); 8 Jul 2001 15:21:35 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Jul 2001 15:21:35 -0000 Received: (qmail 4543 invoked by alias); 8 Jul 2001 15:20:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15310 Received: (qmail 4532 invoked from network); 8 Jul 2001 15:20:29 -0000 From: "Bart Schaefer" Message-Id: <1010708151933.ZM18654@candle.brasslantern.com> Date: Sun, 8 Jul 2001 15:19:32 +0000 In-Reply-To: Comments: In reply to Peter Stephenson "Re: PATCH: Re: Is PRINT_EXIT_VALUE supposed to work?" (Jul 3, 6:13pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: Re: Is PRINT_EXIT_VALUE supposed to work? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jul 3, 6:13pm, Peter Stephenson wrote: } Subject: Re: PATCH: Re: Is PRINT_EXIT_VALUE supposed to work? } } I've been a long time getting around to looking at this, but does this } really work? } } zsh -c 'setopt printexitvalue; fn() { false;}; fn' This works for me now: schaefer[652] Src/zsh -fc 'setopt printexitvalue; fn() { false;}; fn' zsh: exit 1 schaefer[653] Src/zsh -fc 'fn() { false;}; fn' schaefer[654] I can't see anything that might have changed since 15057 that would have affected this, but there it is. Meanwhile, I think I've spotted a bug in doshfunc(). Can someone explain why the following (or something better that doesn't use `goto') is not necessary? (I won't commit it until I get second opinions from Sven and PWS.) Index: Src/exec.c =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/exec.c,v retrieving revision 1.7 diff -c -r1.7 exec.c --- exec.c 2001/06/28 08:40:25 1.7 +++ exec.c 2001/07/08 15:17:02 @@ -3359,9 +3359,7 @@ if(++funcdepth > MAX_FUNCTION_DEPTH) { zerr("maximum nested function level reached", NULL, 0); - scriptname = oldscriptname; - popheap(); - return; + goto undoshfunc; } #endif fstack.name = dupstring(name); @@ -3382,14 +3380,14 @@ errflag = 1; else lastval = 1; - popheap(); - scriptname = oldscriptname; - return; + goto doneshfunc; } prog = shf->funcdef; } runshfunc(prog, wrappers, fstack.name); + doneshfunc: funcstack = fstack.prev; + undoshfunc: #ifdef MAX_FUNCTION_DEPTH --funcdepth; #endif -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net