diff options
author | Stefan Farfeleder <stefanf@FreeBSD.org> | 2005-12-08 21:00:39 +0000 |
---|---|---|
committer | Stefan Farfeleder <stefanf@FreeBSD.org> | 2005-12-08 21:00:39 +0000 |
commit | 3f0131f65b888f7bfb635fdbf82891b884cd2f91 (patch) | |
tree | e0a9d5586f013cd9acd95e6d19423535dd10a1af /bin/sh/output.c | |
parent | 2a5e306d4636cffafe9736dafb30009074ba5e65 (diff) | |
download | src-3f0131f65b888f7bfb635fdbf82891b884cd2f91.tar.gz src-3f0131f65b888f7bfb635fdbf82891b884cd2f91.zip |
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=".
Notes
Notes:
svn path=/head/; revision=153245
Diffstat (limited to 'bin/sh/output.c')
-rw-r--r-- | bin/sh/output.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/sh/output.c b/bin/sh/output.c index 3550cb7ecb7d..b59e11e0e870 100644 --- a/bin/sh/output.c +++ b/bin/sh/output.c @@ -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); |