Don't modify output that is to be quoted if it contains no IFS characters

or shell metacharacters.
This commit is contained in:
Tim J. Robbins 2002-06-06 03:29:23 +00:00
parent c48e5a6b24
commit dee75cf75d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97909

View File

@ -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) {