From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29684 invoked from network); 20 Sep 2005 15:17:41 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Sep 2005 15:17:41 -0000 Received: (qmail 54592 invoked from network); 20 Sep 2005 15:17:35 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Sep 2005 15:17:35 -0000 Received: (qmail 12612 invoked by alias); 20 Sep 2005 15:17:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21737 Received: (qmail 12603 invoked from network); 20 Sep 2005 15:17:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 20 Sep 2005 15:17:32 -0000 Received: (qmail 54309 invoked from network); 20 Sep 2005 15:17:32 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 20 Sep 2005 15:17:31 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 20 Sep 2005 16:15:09 +0100 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 20 Sep 2005 16:19:05 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j8KFHUpo021405 for ; Tue, 20 Sep 2005 16:17:30 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j8KFHT7w021402 for ; Tue, 20 Sep 2005 16:17:29 +0100 Message-Id: <200509201517.j8KFHT7w021402@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: multibyte $WORDCHARS In-reply-to: <200509201506.j8KF6f9X020818@news01.csr.com> References: <200509201506.j8KF6f9X020818@news01.csr.com> Date: Tue, 20 Sep 2005 16:17:29 +0100 From: Peter Stephenson X-OriginalArrivalTime: 20 Sep 2005 15:19:05.0123 (UTC) FILETIME=[A36AFF30:01C5BDF6] X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Peter Stephenson wrote: > This fully fixes up WORDCHARS to use multibyte characters, with the > single exception of the [[:WORD:]] test --- I don't want to mess around > with the pattern code until we start work properly on the main shell. Excepting as how I forgot to unmetafy wordchars before exploring its ichness. I suspect a NULL before the end of WORDCHARS may wreak havoc. Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.91 diff -u -r1.91 utils.c --- Src/utils.c 20 Sep 2005 15:10:27 -0000 1.91 +++ Src/utils.c 20 Sep 2005 15:14:47 -0000 @@ -2499,15 +2499,18 @@ } #ifdef ZLE_UNICODE_SUPPORT if (wordchars) { - const char *wordchars_ptr = wordchars; + char *wordchars_unmeta; + const char *wordchars_ptr; mbstate_t mbs; - int nchars; + int nchars, unmetalen; + + wordchars_unmeta = dupstring(wordchars); + wordchars_ptr = unmetafy(wordchars_unmeta, &unmetalen); memset(&mbs, 0, sizeof(mbs)); wordchars_wide = (wchar_t *) - zrealloc(wordchars_wide, (strlen(wordchars)+1)*sizeof(wchar_t)); - nchars = mbsrtowcs(wordchars_wide, &wordchars_ptr, strlen(wordchars), - &mbs); + zrealloc(wordchars_wide, (unmetalen+1)*sizeof(wchar_t)); + nchars = mbsrtowcs(wordchars_wide, &wordchars_ptr, unmetalen, &mbs); if (nchars == -1) { /* Conversion state is undefined: better just set to null */ *wordchars_wide = L'\0'; -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, 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. **********************************************************************