mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
30169: repeat "typeset -T" with same two first arguments is not an error
This commit is contained in:
parent
1849668c81
commit
268e56a144
4 changed files with 31 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
|||
2012-08-16 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 30619: Doc/Zsh/builtins.yo, Src/builtin.c,
|
||||
Test/B02typeset.ztst: repeat "typeset -T" with same two first
|
||||
arguments is not an error.
|
||||
|
||||
* 30617: Src/prototypes.h, Src/zsh_system.h: rationalise
|
||||
replacement of tgoto() prototype which could appear twice
|
||||
inconsistently.
|
||||
|
@ -57,5 +61,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5695 $
|
||||
* $Revision: 1.5696 $
|
||||
*****************************************************
|
||||
|
|
|
@ -1552,7 +1552,9 @@ an array to var(SCALAR) is an error, and assigning a scalar to var(array)
|
|||
sets it to be a single-element array. Note that both `tt(typeset -xT ...)'
|
||||
and `tt(export -T ...)' work, but only the scalar will be marked for
|
||||
export. Setting the value using the scalar version causes a split on all
|
||||
separators (which cannot be quoted).
|
||||
separators (which cannot be quoted). It is possible to use the
|
||||
same two tied variables with a different separator character in which
|
||||
case the variables remain joined as before but the separator is changed.
|
||||
|
||||
The tt(-g) (global) flag is treated specially: it means that any
|
||||
resulting parameter will not be restricted to local scope. Note that this
|
||||
|
|
|
@ -2449,7 +2449,20 @@ bin_typeset(char *name, char **argv, Options ops, int func)
|
|||
&& (locallevel == pm->level || !(on & PM_LOCAL))) {
|
||||
if (pm->node.flags & PM_TIED) {
|
||||
unqueue_signals();
|
||||
zerrnam(name, "can't tie already tied scalar: %s", asg0.name);
|
||||
if (!strcmp(asg->name, pm->ename)) {
|
||||
/*
|
||||
* Already tied in the fashion requested.
|
||||
*/
|
||||
struct tieddata *tdp = (struct tieddata*)pm->u.data;
|
||||
/* Update join character */
|
||||
tdp->joinchar = joinchar;
|
||||
if (asg0.value)
|
||||
setsparam(asg0.name, ztrdup(asg0.value));
|
||||
return 0;
|
||||
} else {
|
||||
zerrnam(name, "can't tie already tied scalar: %s",
|
||||
asg0.name);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (!asg0.value && !(PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED)))
|
||||
|
|
|
@ -459,3 +459,12 @@
|
|||
silent2(){ local silence; silent1; }
|
||||
silent2
|
||||
0:typeset -g should be silent even without TYPESET_SILENT
|
||||
|
||||
typeset -T TIED_SCALAR tied_array
|
||||
TIED_SCALAR=foo:bar
|
||||
print $tied_array
|
||||
typeset -T TIED_SCALAR=goo:car tied_array
|
||||
print $tied_array
|
||||
0:retying arrays to same array works
|
||||
>foo bar
|
||||
>goo car
|
||||
|
|
Loading…
Reference in a new issue