From 3f0131f65b888f7bfb635fdbf82891b884cd2f91 Mon Sep 17 00:00:00 2001 From: Stefan Farfeleder Date: Thu, 8 Dec 2005 21:00:39 +0000 Subject: [PATCH] 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(+) diff --git a/bin/sh/output.c b/bin/sh/output.c index 3550cb7ecb7..b59e11e0e87 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);