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
This commit is contained in:
Ted Kremenek 2008-11-03 07:44:16 +00:00
Родитель f8fc414bc0
Коммит 87f8de72a3
1 изменённых файлов: 5 добавлений и 8 удалений

Просмотреть файл

@ -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;
}
##----------------------------------------------------------------------------##