mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Print empty quotes ('') when an empty string is passed to outqstr().
This makes a difference for the trap builtin, where after "trap '' 0" we printed "trap -- quit". This is wrong, because an empty action means to reset the action to the default. A side effect of this commit is that empty variables are now printed as "variable=''" instead of just "variable=".
This commit is contained in:
parent
2a5e306d46
commit
3f0131f65b
1 changed files with 4 additions and 0 deletions
|
|
@ -134,6 +134,10 @@ outqstr(const char *p, struct output *file)
|
|||
{
|
||||
char ch;
|
||||
|
||||
if (p[0] == '\0') {
|
||||
outstr("''", file);
|
||||
return;
|
||||
}
|
||||
if (p[strcspn(p, "|&;<>()$`\\\"'")] == '\0' && (!ifsset() ||
|
||||
p[strcspn(p, ifsval())] == '\0')) {
|
||||
outstr(p, file);
|
||||
|
|
|
|||
Loading…
Reference in a new issue