mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
19167: fix NUL at start of BRACE_CCL range.
This commit is contained in:
parent
530bbb503e
commit
bbc409eefe
@ -1,5 +1,8 @@
|
||||
2003-10-06 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
|
||||
|
||||
* 19167: Src/glob.c, Test/E01options.ztst: NULL at start
|
||||
of BRACE_CCL range didn't work.
|
||||
|
||||
* unposted: Doc/Zsh/.distfiles, Src/zsh.mdd,
|
||||
Src/Modules/.distfiles: update distribution files for
|
||||
18980 (zsh/system) and 19053 (Functions/MIME).
|
||||
|
11
Src/glob.c
11
Src/glob.c
@ -1867,12 +1867,13 @@ xpandbraces(LinkList list, LinkNode *np)
|
||||
* set of flags saying whether each character is present; *
|
||||
* the final list is in lexical order. */
|
||||
char ccl[256], *p;
|
||||
unsigned char c1, c2, lastch;
|
||||
unsigned char c1, c2;
|
||||
unsigned int len, pl;
|
||||
int lastch = -1;
|
||||
|
||||
uremnode(list, node);
|
||||
memset(ccl, 0, sizeof(ccl) / sizeof(ccl[0]));
|
||||
for (p = str + 1, lastch = 0; p < str2;) {
|
||||
for (p = str + 1; p < str2;) {
|
||||
if (itok(c1 = *p++))
|
||||
c1 = ztokens[c1 - STOUC(Pound)];
|
||||
if ((char) c1 == Meta)
|
||||
@ -1881,10 +1882,10 @@ xpandbraces(LinkList list, LinkNode *np)
|
||||
c2 = ztokens[c2 - STOUC(Pound)];
|
||||
if ((char) c2 == Meta)
|
||||
c2 = 32 ^ p[1];
|
||||
if (c1 == '-' && lastch && p < str2 && (int)lastch <= (int)c2) {
|
||||
while ((int)lastch < (int)c2)
|
||||
if (c1 == '-' && lastch >= 0 && p < str2 && lastch <= (int)c2) {
|
||||
while (lastch < (int)c2)
|
||||
ccl[lastch++] = 1;
|
||||
lastch = 0;
|
||||
lastch = -1;
|
||||
} else
|
||||
ccl[lastch = c1] = 1;
|
||||
}
|
||||
|
@ -154,6 +154,19 @@
|
||||
>a b c d
|
||||
>{abcd}
|
||||
|
||||
# Don't use NUL as a field separator in the following.
|
||||
setopt braceccl
|
||||
print {$'\0'-$'\5'} | IFS=' ' read -A chars
|
||||
for c in $chars; do print $(( #c )); done
|
||||
unsetopt braceccl
|
||||
0:BRACE_CCL option starting from NUL
|
||||
>0
|
||||
>1
|
||||
>2
|
||||
>3
|
||||
>4
|
||||
>5
|
||||
|
||||
setopt bsdecho
|
||||
echo "histon\nimpington"
|
||||
echo -e "girton\ncottenham"
|
||||
|
Loading…
Reference in New Issue
Block a user