From 0dcfd185aff80e3d2e75ab6f9c203126f3311c1b Mon Sep 17 00:00:00 2001 From: stefanf Date: Thu, 8 Dec 2005 21:00:39 +0000 Subject: 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=". --- bin/sh/output.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bin') diff --git a/bin/sh/output.c b/bin/sh/output.c index 3550cb7..b59e11e 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); -- cgit v1.1