winetest.cgi cleanup
Ferenc Wagner
wferi at afavant.elte.hu
Fri Feb 20 11:50:30 CST 2004
ChangeLog: Fit it into the system.
Index: winetest.cgi
===================================================================
RCS file: /home/wine/tools/winetest/winetest.cgi,v
retrieving revision 1.1
diff -u -r1.1 winetest.cgi
--- winetest.cgi 19 Feb 2004 22:00:34 -0000 1.1
+++ winetest.cgi 20 Feb 2004 17:48:26 -0000
@@ -1,7 +1,26 @@
#!/usr/bin/perl
+#
+# Copyright (C) 2004 Ferenc Wagner
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+use strict;
+use vars qw/$queuedir/;
BEGIN {
- require "winetest.conf";
+ require "../wine/winetest.conf";
$ENV{TMPDIR} = $queuedir;
}
@@ -11,53 +30,47 @@
my $name = param ("reportfile");
my $error = cgi_error ();
-my $tmpname = tmpFileName ($name);
-my $fh = upload ("reportfile");
-my $size = -s $tmpname;
sub move_file {
- my ($success, $failure) = @_;
+ my $orig = tmpFileName (shift);
my $tmpdir = tempdir ("repXXXXX", DIR=>$ENV{TMPDIR});
- print h3 ("tmpdir: $tmpdir"); # FIXME h3-s
- chmod 0777&~umask, $tmpdir or print h3 ("chmod1: $!");
- chmod 0666&~umask, $tmpname or print h3 ("chmod2: $!");
- print ((rename $tmpname, "$tmpdir/report")?$success:$failure);
+ chmod 0777&~umask, $tmpdir;
+ chmod 0666&~umask, $orig;
+ my $size = -s $orig;
+ (rename $orig, "$tmpdir/report")?
+ "Received $name ($size bytes).\n":
+ "Error: can't store $name: $!\n";
}
+# Invoked by winetest
+
if (user_agent ("Winetests Shell")) {
print header ("text/plain");
- if ($error) { print "Error: $error\n"; }
- else { move_file ("Received $name ($size bytes).\n",
- "Error: can't store $name: $!\n"); }
+ if ($error) {
+ print "Error: $error\n";
+ } elsif ($name) {
+ print move_file $name;
+ }
exit;
}
-if ($error) {
- print (header (-status=>$error),
- start_html ("Problems"),
- h2 ("Error during file upload ($name)"),
- strong ($error),
- end_html);
- exit;
-}
+# Invoked by a browser
-print (header,
- start_html ("Winetests report upload"),
- h1 ("Winetests report upload"));
-
-# Start a multipart form.
-print (start_multipart_form (),
- "The name of the report file:",
- filefield ("reportfile","c:\\temp\\res",45),
- p,
- reset, submit ("submit","Upload File"),
- endform);
-
-# Process the form if there is a file name entered
-if ($name) {
- print hr;
- move_file (h2 ("Received $name ($size bytes)."),
- h2 ("Error: can't store $name: $!"));
-}
+print header,
+ start_html ("Winetests report upload"),
+ h1 ("Winetests report upload"),
+ start_multipart_form (),
+ "The name of the report file:",
+ filefield ("reportfile","c:\\temp\\res",45),
+ p,
+ reset, submit ("submit","Upload File"),
+ endform,
+ hr;
+if ($error) {
+ print h2 ("Error during file upload ($name)"),
+ strong ($error);
+} elsif ($name) {
+ print h2 move_file $name;
+}
print end_html;
More information about the wine-patches
mailing list