From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16158 invoked from network); 15 May 2000 10:59:51 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 May 2000 10:59:51 -0000 Received: (qmail 9022 invoked by alias); 15 May 2000 10:59:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11368 Received: (qmail 9006 invoked from network); 15 May 2000 10:59:21 -0000 Date: Mon, 15 May 2000 12:59:07 +0200 (MET DST) Message-Id: <200005151059.MAA15570@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 14 May 2000 07:50:25 +0900 Subject: PATCH: Re: splitting with empty separator. Tanaka Akira wrote: > Z(4):akr@serein% zsh -f > serein% a=$'\0'; b=(${(s::)a}); print $#b > 2 > serein% print -lr - $b[1] > s::-lr > serein% > > Hm. Splitting with empty separator generates curious result. > Maybe a metafied character is splitted? Yes, seems as if it was only missing for the special case of a given but empty separator string. Bye Sven Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.4 diff -u -r1.4 utils.c --- Src/utils.c 2000/05/08 15:56:37 1.4 +++ Src/utils.c 2000/05/15 10:58:27 @@ -1764,7 +1764,14 @@ return i; } if (!sep[0]) { - return **s ? ++*s, 1 : -1; + if (**s) { + if (**s == Meta) + *s += 2; + else + ++*s; + return 1; + } + return -1; } for (i = 0; **s; i++) { for (t = sep, tt = *s; *t && *tt && *t == *tt; t++, tt++); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de