From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21698 invoked from network); 19 Feb 2009 10:06:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Feb 2009 10:06:05 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 20658 invoked from network); 19 Feb 2009 10:05:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Feb 2009 10:05:57 -0000 Received: (qmail 5596 invoked by alias); 19 Feb 2009 10:05:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26583 Received: (qmail 5580 invoked from network); 19 Feb 2009 10:05:50 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Feb 2009 10:05:50 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id B171380271F0 for ; Thu, 19 Feb 2009 11:05:46 +0100 (CET) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly23g.srv.mailcontrol.com (MailControl) with ESMTP id n1JA4dl4006037 for ; Thu, 19 Feb 2009 10:05:43 GMT Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Feb 2009 10:02:12 +0000 Date: Thu, 19 Feb 2009 10:02:11 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: Clarify zshaddhistory doc? Message-ID: <20090219100211.74bc9b18@news01> In-Reply-To: <090218103939.ZM17460@torch.brasslantern.com> References: <090218085720.ZM17261@torch.brasslantern.com> <200902181709.n1IH9DsQ019474@news01.csr.com> <090218103939.ZM17460@torch.brasslantern.com> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Feb 2009 10:02:12.0603 (UTC) FILETIME=[229AACB0:01C99279] X-Scanned-By: MailControl A_08_51_00 (www.mailcontrol.com) on 10.71.0.133 X-Virus-Scanned: ClamAV 0.92.1/9002/Wed Feb 18 12:16:50 2009 on bifrost X-Virus-Status: Clean On Wed, 18 Feb 2009 10:39:39 -0800 Bart Schaefer wrote: > On Feb 18, 5:09pm, Peter Stephenson wrote: > } > } > What exactly does this mean? There's no $zshaddhistory_functions array > } > so "any of the hook functions" is either a typo, or must refer to the > } > $preexec_functions hooks, which ought to be clearer. > } > } There isn't a zshaddhistory_functions array until you add one, then > } there is. > > Hrm. Well, then, perhaps the explicit reference to "preexec_functions" > in Src/init.c is wrong, and it should be using the HOOK_SUFFIX constant? Index: Src/init.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/init.c,v retrieving revision 1.98 diff -u -r1.98 init.c --- Src/init.c 11 Feb 2009 20:42:16 -0000 1.98 +++ Src/init.c 19 Feb 2009 09:57:52 -0000 @@ -150,7 +150,7 @@ if (toplevel && (getshfunc("preexec") || - paramtab->getnode(paramtab, "preexec_functions"))) { + paramtab->getnode(paramtab, "preexec" HOOK_SUFFIX))) { LinkList args; char *cmdstr; Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.208 diff -u -r1.208 utils.c --- Src/utils.c 5 Jan 2009 21:56:53 -0000 1.208 +++ Src/utils.c 19 Feb 2009 09:57:52 -0000 @@ -1174,8 +1174,6 @@ if (arrayp) { char **arrptr; int namlen = strlen(name); -#define HOOK_SUFFIX "_functions" -#define HOOK_SUFFIX_LEN 11 /* including NUL byte */ VARARR(char, arrnam, namlen + HOOK_SUFFIX_LEN); memcpy(arrnam, name, namlen); memcpy(arrnam + namlen, HOOK_SUFFIX, HOOK_SUFFIX_LEN); Index: Src/zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.152 diff -u -r1.152 zsh.h --- Src/zsh.h 11 Feb 2009 20:42:16 -0000 1.152 +++ Src/zsh.h 19 Feb 2009 09:57:52 -0000 @@ -1117,6 +1117,15 @@ #define WRAPDEF(func) \ { NULL, 0, func, NULL } +/* + * User-defined hook arrays + */ + +/* Name appended to function name to get hook array */ +#define HOOK_SUFFIX "_functions" +/* Length of that including NUL byte */ +#define HOOK_SUFFIX_LEN 11 + /* node in builtin command hash table (builtintab) */ /* -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070