From d658a1e5c790166834e3f1c86f9cc2661ee27173 Mon Sep 17 00:00:00 2001 From: tjr Date: Thu, 6 Jun 2002 03:29:23 +0000 Subject: [PATCH] Don't modify output that is to be quoted if it contains no IFS characters or shell metacharacters. --- bin/sh/output.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/sh/output.c b/bin/sh/output.c index 9b8fa5cf1b61..ab56b427ace0 100644 --- a/bin/sh/output.c +++ b/bin/sh/output.c @@ -68,6 +68,7 @@ static const char rcsid[] = #include "output.h" #include "memalloc.h" #include "error.h" +#include "var.h" #define OUTBUFSIZ BUFSIZ @@ -140,6 +141,12 @@ outqstr(const char *p, struct output *file) { char ch; + if (p[strcspn(p, "|&;<>()$`\\\"'")] == '\0' && (!ifsset() || + p[strcspn(p, ifsval())] == '\0')) { + outstr(p, file); + return; + } + out1c('\''); while ((ch = *p++) != '\0') { switch (ch) {