print start_html
("File Diff Example");
print "<strong>Version </strong>$CGI::VERSION<p>";
<H1>File Diff Example</H1>
Enter two files. When you press "submit" their diff will be
# Start a multipart form.
print start_multipart_form
;
print "File #1:",filefield
(-name
=>'file1',-size
=>45),"<BR>\n";
print "File #2:",filefield
(-name
=>'file2',-size
=>45),"<BR>\n";
print "Diff type: ",radio_group
(-name
=>'type',
-value
=>['context','normal']),"<br>\n";
print reset,submit
(-name
=>'submit',-value
=>'Do Diff');
# Process the form if there is a file name entered
$realfile1 = tmpFileName
($file1);
$realfile2 = tmpFileName
($file2);
print "<H2>$file1 vs $file2</H2>\n";
$options = "-c" if param
('type') eq 'context';
system "$DIFF $options $realfile1 $realfile2 | $PERL -pe 's/>/>/g; s/</</g;'";
<A HREF="../cgi_docs.html">CGI documentation</A>
<A HREF="/~lstein">Lincoln D. Stein</A>
Last modified 17 July 1996
my($safe) = $name=~/([a-zA-Z0-9._~#,]+)/;
print "<strong>$name is not a valid Unix filename -- sorry</strong>";