[llvm-commits] CVS: llvm-www/demo/index.cgi

Chris Lattner sabre at nondot.org
Mon Oct 1 12:22:35 PDT 2007



Changes in directory llvm-www/demo:

index.cgi updated: 1.75 -> 1.76
---
Log message:

only log and mail if the code is not the default code.


---
Diffs of the changes:  (+17 -11)

 index.cgi |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)


Index: llvm-www/demo/index.cgi
diff -u llvm-www/demo/index.cgi:1.75 llvm-www/demo/index.cgi:1.76
--- llvm-www/demo/index.cgi:1.75	Sun Sep 30 17:23:13 2007
+++ llvm-www/demo/index.cgi	Mon Oct  1 14:21:45 2007
@@ -18,10 +18,10 @@
 
 my $LOGFILE         = "$ROOT/log.txt";
 my $FORM_URL        = 'index.cgi';
+my $MAILADDR        = 'sabre at nondot.org';
 my $CONTACT_ADDRESS = 'Questions or comments?  Email the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev mailing list</a>.';
 my $LOGO_IMAGE_URL  = 'cathead.png';
 my $TIMEOUTAMOUNT   = 20;
-$ENV{'LLVM_LIB_SEARCH_PATH'} = '/home/vadve/gaeke/llvm/Release/runtime/';
 $ENV{'LD_LIBRARY_PATH'} = '/home/vadve/shared/localtools/fc1/lib/';
 
 my @PREPENDPATHDIRS =
@@ -29,6 +29,12 @@
     '/home/vadve/shared/llvm-gcc4.0-2.1/bin/',
     '/home/vadve/shared/llvm-2.1/Release/bin');
 
+my $defaultsrc = "#include <stdio.h>\n#include <stdlib.h>\n\n" .
+                 "int power(int X) {\n  if (X == 0) return 1;\n" .
+                 "  return X*power(X-1);\n}\n\n" .
+                 "int main(int argc, char **argv) {\n" .
+                 "  printf(\"%d\\n\", power(atoi(argv[0])));\n}\n";
+
 sub getname {
     my ($extension) = @_;
     for ( my $count = 0 ; ; $count++ ) {
@@ -166,14 +172,8 @@
 my $source = $c->param('source');
 
 
-# Start the user out with something valid.
-if (!defined($source)) {
-  $source = "#include <stdio.h>\n#include <stdlib.h>\n\n" .
-            "int power(int X) {\n  if (X == 0) return 1;\n" .
-            "  return X*power(X-1);\n}\n\n" .
-            "int main(int argc, char **argv) {\n" .
-            "  printf(\"%d\\n\", power(atoi(argv[0])));\n}\n";
-}
+# Start the user out with something valid if no code.
+$source = $defaultsrc if (!defined($source));
 
 print $c->textarea(
     -name    => "source",
@@ -448,6 +448,12 @@
       try_run("llvm2cpp","llvm2cpp $bytecodeFile -o $l2cppFile 2>&1",
         $l2cppFile);
     }
+
+    # Get the source presented by the user to CGI, convert newline sequences to simple \n.
+    my $actualsrc = $c->param('source');
+    $actualsrc =~ s/\015\012/\n/go;
+    # Don't log this or mail it if it is the default code.
+    if ($actualsrc ne $defaultsrc) {
     addlog( $source, $pid, $UnhilightedResult );
 
     my ( $ip, $host, $lg, $lines );
@@ -455,7 +461,7 @@
     $lg = $c->param('language');
     $ip = $c->remote_addr();
     chomp( $host = `host $ip` ) if $ip;
-    mailto( 'sabre at nondot.org',
+    mailto( $MAILADDR',
         "--- Query: ---\nFrom: ($ip) $host\nInput: $lines lines of $lg\n"
           . "C++ demangle = "
           . ( $c->param('cxxdemangle') ? 1 : 0 )
@@ -465,7 +471,7 @@
           . ( $c->param('showstats') ? 1 : 0 ) . "\n\n"
           . "--- Source: ---\n$source\n"
           . "--- Result: ---\n$UnhilightedResult\n" );
-
+    }
     unlink( $inputFile, $bytecodeFile, $outputFile, $disassemblyFile );
 }
 






More information about the llvm-commits mailing list