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
diff --git a/utils/scan-build b/utils/scan-build
index 41dd29e..0d4bc90 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -932,9 +932,9 @@
   # 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 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;
 }
 
 ##----------------------------------------------------------------------------##