From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5236 invoked from network); 20 Sep 2004 14:00:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Sep 2004 14:00:54 -0000 Received: (qmail 15191 invoked from network); 20 Sep 2004 14:00:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Sep 2004 14:00:48 -0000 Received: (qmail 18054 invoked by alias); 20 Sep 2004 14:00:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20392 Received: (qmail 18045 invoked from network); 20 Sep 2004 14:00:34 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 20 Sep 2004 14:00:34 -0000 Received: (qmail 14707 invoked from network); 20 Sep 2004 13:59:37 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 20 Sep 2004 13:59:36 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i8KDxWv00202 for ; Mon, 20 Sep 2004 13:59:33 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Mon, 20 Sep 2004 14:58:34 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 20 Sep 2004 15:00:59 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i8KDxTmW007558 for ; Mon, 20 Sep 2004 14:59:29 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i8KDxSiC007555 for ; Mon, 20 Sep 2004 14:59:29 +0100 Message-Id: <200409201359.i8KDxSiC007555@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: PATCH: exit after 10 EOF's In-reply-to: References: <200409131118.i8DBIM5B005245@news01.csr.com> <20040919175211.3557D863A@pwstephenson.fsnet.co.uk> Date: Mon, 20 Sep 2004 14:59:27 +0100 From: Peter Stephenson X-OriginalArrivalTime: 20 Sep 2004 14:00:59.0419 (UTC) FILETIME=[41BE8EB0:01C49F1A] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 I've applied these two patches and now I get the message from within zle (no reprinting of command line) when I have a zle -N widget bound to ^D, but the shell doesn't exit. If I use a completion widget I get the message and the prompt is reprinted from the main shell. The following is what I have applied. Index: Src/init.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/init.c,v retrieving revision 1.43 diff -u -r1.43 init.c --- Src/init.c 13 Sep 2004 13:04:55 -0000 1.43 +++ Src/init.c 20 Sep 2004 13:58:02 -0000 @@ -37,7 +37,7 @@ #include "version.h" /**/ -mod_export int noexitct = 0; +int noexitct = 0; /* buffer for $_ and its length */ Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.51 diff -u -r1.51 zle_main.c --- Src/Zle/zle_main.c 13 Sep 2004 13:04:55 -0000 1.51 +++ Src/Zle/zle_main.c 20 Sep 2004 13:58:07 -0000 @@ -688,30 +688,23 @@ selectlocalmap(NULL); bindk = getkeycmd(); if (bindk) { - if (!ll && isfirstln && lastchar == eofchar) { + if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) && + lastchar == eofchar) { /* * Slight hack: this relies on getkeycmd returning * a value for the EOF character. However, * undefined-key is fine. That's necessary because * otherwise we can't distinguish this case from * a ^C. - * - * The noxitct test is done in the top-level loop - * if zle is not running. As we trap EOFs at this - * level inside zle we need to mimic it here. - * If we break, the top-level loop will actually increment - * noexitct an extra time; that doesn't cause any - * problems. */ - if (!(zlereadflags & ZLRF_IGNOREEOF) || - ++noexitct >= 10) - { - eofsent = 1; - break; - } + eofsent = 1; + break; } - if (execzlefunc(bindk, zlenoargs)) + if (execzlefunc(bindk, zlenoargs)) { handlefeep(zlenoargs); + if (eofsent) + break; + } handleprefixes(); /* for vi mode, make sure the cursor isn't somewhere illegal */ if (invicmdmode() && cs > findbol() && @@ -904,10 +897,17 @@ } else if((w = func->widget)->flags & (WIDGET_INT|WIDGET_NCOMP)) { int wflags = w->flags; - if (keybuf[0] == eofchar && !keybuf[1] && + /* + * The rule is that "zle -N" widgets suppress EOF warnings. When + * a "zle -N" widget invokes "zle another-widget" we pass through + * this code again, but with actual arguments rather than with the + * zlenoargs placeholder. + */ + if (keybuf[0] == eofchar && !keybuf[1] && args == zlenoargs && !ll && isfirstln && (zlereadflags & ZLRF_IGNOREEOF)) { showmsg((!islogin) ? "zsh: use 'exit' to exit." : "zsh: use 'logout' to logout."); + eofsent = 1; ret = 1; } else { if(!(wflags & ZLE_KEEPSUFFIX)) -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************