projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add uref for call in edu
[spider.git]
/
cmd
/
show
/
contest.pl
diff --git
a/cmd/show/contest.pl
b/cmd/show/contest.pl
index 8f83d949c517072904ca92d21612cac5f895ef5c..cb5b0a04705ff656cee51c8284b8d6f5958661c2 100644
(file)
--- a/
cmd/show/contest.pl
+++ b/
cmd/show/contest.pl
@@
-9,7
+9,7
@@
my ($self, $line) = @_;
my ($self, $line) = @_;
-return (1, "usage: sh/contest <year_and_month>, e g sh/contest 2002sep ") unless $line;
+
#
return (1, "usage: sh/contest <year_and_month>, e g sh/contest 2002sep ") unless $line;
my @out;
my @out;
@@
-20,18
+20,24
@@
my $mon;;
$line = lc $line;
my ($m,$y) = $line =~ /^([a-z]{3})\w*\s*(\d+)/;
($y,$m) = $line =~ /^(\d+)\s*([a-z]{3})/ unless $y && $m;
$line = lc $line;
my ($m,$y) = $line =~ /^([a-z]{3})\w*\s*(\d+)/;
($y,$m) = $line =~ /^(\d+)\s*([a-z]{3})/ unless $y && $m;
+unless ($y && $m) {
+ ($m,$y) = (gmtime)[4,5];
+ $m = qw(jan feb mar apr may jun jul aug sep oct nov dec)[$m];
+ $y += 1900;
+}
$y += 2000 if $y <= 50;
$y += 1900 if $y > 50 && $y <= 99;
$m = 'oct' if $m eq 'okt';
$m = 'may' if $m eq 'mai' || $m eq 'maj';
$mon = "$y$m";
$y += 2000 if $y <= 50;
$y += 1900 if $y > 50 && $y <= 99;
$m = 'oct' if $m eq 'okt';
$m = 'may' if $m eq 'mai' || $m eq 'maj';
$mon = "$y$m";
-dbg($mon);
+dbg($mon)
if isdbg('contest')
;
my $filename = "c" . $mon . ".txt";
my $filename = "c" . $mon . ".txt";
-my $host = 'www.sk3bg.se';
+my $host =
$Internet::contest_host ||
'www.sk3bg.se';
my $port = 80;
my $port = 80;
-my $url = "http://www.sk3bg.se/contest/text/$filename";
+my $url = $Internet::contest_url || "http://www.sk3bg.se/contest/text";
+$url .= "/$filename";
my $t = new Net::Telnet (Telnetmode => 0);
eval {
my $t = new Net::Telnet (Telnetmode => 0);
eval {
@@
-41,7
+47,7
@@
eval {
if (!$t || $@) {
push @out, $self->msg('e18','sk3bg.se');
} else {
if (!$t || $@) {
push @out, $self->msg('e18','sk3bg.se');
} else {
- my $s = "GET
http://www.sk3bg.se/contest/text/$filename
";
+ my $s = "GET
$url
";
$t->print($s);
my $notfound = $t->getline(Timeout => 10);
if ($notfound =~ /404 Object Not Found/) {
$t->print($s);
my $notfound = $t->getline(Timeout => 10);
if ($notfound =~ /404 Object Not Found/) {