[llvm-commits] CVS: llvm-www/random-box.cgi

Chris Lattner lattner at cs.uiuc.edu
Fri May 28 02:30:01 PDT 2004


Changes in directory llvm-www:

random-box.cgi added (r1.1)

---
Log message:

New script


---
Diffs of the changes:  (+25 -0)

Index: llvm-www/random-box.cgi
diff -c /dev/null llvm-www/random-box.cgi:1.1
*** /dev/null	Fri May 28 02:26:31 2004
--- llvm-www/random-box.cgi	Fri May 28 02:26:21 2004
***************
*** 0 ****
--- 1,25 ----
+ #!/usr/bin/perl -w
+ 
+ print "Content-type: text/html\n\n";
+ 
+ sub ReadFile {
+   undef $/;
+   if (open (FILE, $_[0])) {
+     my $Ret = <FILE>;
+     close FILE;
+     return $Ret;
+   } else {
+     print "Could not open file '$_[0]' for reading!";
+     return "";
+   }
+ }
+ 
+ 
+ opendir DH, "RandomBoxes" or die "Where'd RandomBoxes go?";
+ @Files = grep /[0-9]/, readdir DH;
+ closedir DH;
+ 
+ srand(time ^ $$);
+ print ReadFile "RandomBoxes/" . $Files[rand(@Files)];
+ print "\n";
+ exit(0);





More information about the llvm-commits mailing list