From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5174 invoked from network); 14 Aug 2001 16:05:10 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Aug 2001 16:05:10 -0000 Received: (qmail 24689 invoked by alias); 14 Aug 2001 16:05:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15627 Received: (qmail 24672 invoked from network); 14 Aug 2001 16:05:02 -0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: EOF exiting shell In-reply-to: "Adam Spiers"'s message of "Tue, 14 Aug 2001 16:24:04 BST." <20010814162404.A6900@thelonious.new.ox.ac.uk> Date: Tue, 14 Aug 2001 17:04:33 +0100 Message-ID: <4423.997805073@csr.com> From: Peter Stephenson Adam Spiers wrote: > Two queries regarding exiting the shell via ^D: > > - The info pages say that even if IGNOREEOF is set, the shell will > exit after ten EOFs, but in zle_main.c it looks like it needs to > happen 20 times That's a slightly different issue --- it tries to read a single character 20 times, and if that fails it assumes the terminal has gone away. Maybe that's supposed to take over from the IGNOREEOF test in this case? > (although for me it never exits with IGNOREEOF set). Right, I suppose that's a real bug, although I don't know anything about its history. It's not documented, anyway, but possibly someone decided the current way was good enough to avoid shells hanging around too long. In which case, the rest of this message is irrelevant, but I'd like to know for sure, obviously. It looks like it could be fixed by the following --- if the option isn't set, handle EOF unconditionally, if it is, handle it only on a feep. Doesn't seem to conflict with vared's use of ^D's, with or without the -e option. If it was intended that IGNOREEOF should display a message but stay on the same prompt, then this will stomp on that --- for that to work requires a more complicated patch where the number of EOF's is tested inside zle and the test in the main code is bypassed. I'm sure I must be missing something else, though... Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.19 diff -u -r1.19 zle_main.c --- Src/Zle/zle_main.c 2001/07/08 00:32:12 1.19 +++ Src/Zle/zle_main.c 2001/08/14 15:53:03 @@ -560,19 +560,27 @@ prefixflag = 0; zrefresh(); while (!done && !errflag) { + int maybe_eof; statusline = NULL; vilinerange = 0; reselectkeymap(); selectlocalmap(NULL); bindk = getkeycmd(); - if (!ll && isfirstln && unset(IGNOREEOF) && c == eofchar) { + maybe_eof = (!ll && isfirstln && c == eofchar); + if (maybe_eof && unset(IGNOREEOF)) { eofsent = 1; break; } if (bindk) { if (execzlefunc(bindk, zlenoargs)) + { handlefeep(zlenoargs); + if (maybe_eof) { + eofsent = 1; + break; + } + } handleprefixes(); /* for vi mode, make sure the cursor isn't somewhere illegal */ if (invicmdmode() && cs > findbol() && -- Peter Stephenson Software Engineer CSR Ltd., Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************