aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/output.c
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-06-06 03:29:23 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-06-06 03:29:23 +0000
commitdee75cf75df17d366ceec364b6f914dd765d984c (patch)
treea368c71c2d016a29cceea557c8d89df85150acc4 /bin/sh/output.c
parentc48e5a6b2467ca3196418575e927e76db03e828c (diff)
downloadsrc-dee75cf75df17d366ceec364b6f914dd765d984c.tar.gz
src-dee75cf75df17d366ceec364b6f914dd765d984c.zip
Don't modify output that is to be quoted if it contains no IFS characters
or shell metacharacters.
Notes
Notes: svn path=/head/; revision=97909
Diffstat (limited to 'bin/sh/output.c')
-rw-r--r--bin/sh/output.c7
1 files changed, 7 insertions, 0 deletions
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) {