35476: Allow setting $0 when POSIX_ARGZERO is not set

This commit is contained in:
Mikael Magnusson 2015-06-16 01:36:50 +02:00
parent 2cfe892414
commit e55c167083
2 changed files with 19 additions and 1 deletions

View file

@ -3,6 +3,9 @@
* 35477: Completion/Unix/Command/_gdb: _gdb: Allow 'core' to
occur anywhere in a coredump filename
* 35476: Src/params.c: Allow setting $0 when POSIX_ARGZERO is
not set
2015-06-16 Barton E. Schaefer <schaefer@zsh.org>
* 35493: Src/exec.c: erase $_ when the command line is an assignment

View file

@ -196,7 +196,7 @@ static const struct gsu_integer ttyidle_gsu =
{ ttyidlegetfn, nullintsetfn, stdunsetfn };
static const struct gsu_scalar argzero_gsu =
{ argzerogetfn, nullstrsetfn, nullunsetfn };
{ argzerogetfn, argzerosetfn, nullunsetfn };
static const struct gsu_scalar username_gsu =
{ usernamegetfn, usernamesetfn, stdunsetfn };
static const struct gsu_scalar dash_gsu =
@ -4044,6 +4044,21 @@ lcsetfn(Param pm, char *x)
}
#endif /* USE_LOCALE */
/* Function to set value for special parameter `0' */
/**/
static void
argzerosetfn(UNUSED(Param pm), char *x)
{
if (x) {
if (!isset(POSIXARGZERO)) {
zsfree(argzero);
argzero = ztrdup(x);
}
zsfree(x);
}
}
/* Function to get value for special parameter `0' */
/**/