Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
arr=('') broken
- X-seq: zsh-workers 1459
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: arr=('') broken
- Date: Fri, 28 Jun 1996 16:52:14 +0200
Assigning empty strings to arrays (set -A still works OK) was broken
by the changes in untokenisation. This broke my multicomp function.
% sofar=('')
% print $#sofar
0
The patch should be something like the following. I've written it
this way on the assumption that if we get as far as the array code,
the list must have passed through globlist and hence has had unwanted
elements pruned already. As I understand it, globlist() now always
returns untokenised text, and one needs to be careful not to
untokenise twice which can in principal do bad things to
eight-bit-cleanliness, which is why I added the first hunk and removed
the untokenize() in the second hunk.
*** Src/exec.c~ Fri Jun 21 10:47:16 1996
--- Src/exec.c Fri Jun 28 16:46:44 1996
***************
*** 1047,1053 ****
if (empty(vl))
val = ztrdup("");
else {
! untokenize(peekfirst(vl));
val = ztrdup(ugetnode(vl));
}
if (xtr)
--- 1047,1054 ----
if (empty(vl))
val = ztrdup("");
else {
! if (!isset(GLOBASSIGN))
! untokenize(peekfirst(vl));
val = ztrdup(ugetnode(vl));
}
if (xtr)
***************
*** 1066,1075 ****
char *pp;
pp = (char *) ugetnode(vl);
! if (*pp) {
! *ptr = ztrdup(pp);
! untokenize(*ptr++);
! }
}
*ptr = NULL;
if (xtr) {
--- 1067,1073 ----
char *pp;
pp = (char *) ugetnode(vl);
! *ptr++ = ztrdup(pp);
}
*ptr = NULL;
if (xtr) {
--
Peter Stephenson <pws@xxxxxx> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author