aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-11-03 07:44:16 +0000
committerTed Kremenek <kremenek@apple.com>2008-11-03 07:44:16 +0000
commit87f8de72a3c5d61736a14dca271504aaa5020d6f (patch)
tree990a6da23221da28091ab2645c2be2736ccd5ad3
parentf8fc414bc0eaef8be964ec3a05446b2f6707eae3 (diff)
Simplify the functions HtmlEsape and ShellEscape. We now properly print out the following command line in the HTML output: scan-build gcc -x c /dev/null -c -Dfoo='"string abc"'
Fixes <rdar://problem/6338651> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58600 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xutils/scan-build13
1 files changed, 5 insertions, 8 deletions
diff --git a/utils/scan-build b/utils/scan-build
index 41dd29ebaa..0d4bc90d06 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -932,9 +932,9 @@ sub HtmlEscape {
# copy argument to new variable so we don't clobber the original
my $arg = shift || '';
my $tmp = $arg;
-
- $tmp =~ s/([\<\>\'\"])/sprintf("&#%02x;", chr($1))/ge;
-
+ $tmp =~ s/&/&amp;/g;
+ $tmp =~ s/</&lt;/g;
+ $tmp =~ s/>/&gt;/g;
return $tmp;
}
@@ -945,11 +945,8 @@ sub HtmlEscape {
sub ShellEscape {
# copy argument to new variable so we don't clobber the original
my $arg = shift || '';
- my $tmp = $arg;
-
- $tmp =~ s/([\!\;\\\'\"\`\<\>\|\s\(\)\[\]\?\#\$\^\&\*\=])/\\$1/g;
-
- return $tmp;
+ if ($arg =~ /["\s]/) { return "'" . $arg . "'"; }
+ return $arg;
}
##----------------------------------------------------------------------------##