[PATCH] hush.c - export -n flag support
Denys Vlasenko
vda.linux at googlemail.com
Mon Apr 20 22:05:45 UTC 2009
Hi Mike,
Regret to point at a mistake here.
/* ${var=[word]} or ${var:=[word]} */
if (isdigit(var[0]) || var[0] == '#') {
/* mimic bash message */
die_if_script("$%s: cannot assign in this way", var);
val = NULL;
} else {
char *new_var = xasprintf("%s=%s", var, val);
set_local_var(new_var, -1, 0);
Here -1 as a possible set_local_var's export flag was added.
It was also documented:
* flg_export:
* 0: do not export
* 1: export
* -1: if NAME is set, leave export status alone
* if NAME is not set, do not export
* flg_read_only is set only when we handle -R var=val
*/
But set_local_var function does not follow the documentation,
though. -1 works exactly as 0.
I am replacing -1 with 0 in the fragment above, since 0 means "don't
touch export flag", and am adding -1 with the meaning "unset export
if it's set". export -n will use that. Fixing docs (comments) too.
--
vda
More information about the busybox
mailing list