#!/usr/bin/perl $WGET = "wget"; $SCRIPT_NAME = $ENV{'SCRIPT_NAME'} || $0; $CGI = "file://$SCRIPT_NAME"; $_ = $QUERY_STRING = $ENV{"QUERY_STRING"}; if (/subback.html$/) { &subback(); exit; } s@(/\d+)(/([^/]*))?$@$1@ || exit; $label = $3; $cgi = "$CGI?$_"; s@^http://([^/]+)/test/read.cgi/([^/]+)/@$1/$2/dat/@ || exit; $subback = "$CGI?http://$1/$2/subback.html"; $_ .= ".dat"; $dat = "http://$_"; $tmp = $ENV{"HOME"} . "/.w3m2ch/$_"; $dat =~ s/([^\w\/.\:\-])/\\$1/g; $tmp =~ s/([^\w\/.\:\-])/\\$1/g; ($dir = $tmp) =~ s@/[^/]+$@@; $cmd = "mkdir -p $dir; $WGET -c -O $tmp $dat >/dev/null 2>&1"; system $cmd; $lines = (split(" ", `wc $tmp`))[0]; $lines || exit; @ARGV = ($tmp); if ($label =~ /^l(\d+)/) { $start = $lines - $1 + 1; if ($start < 1) { $start = 1; } $end = $lines; } elsif ($label =~ /^(\d+)-(\d+)/) { $start = $1; $end = $2; } elsif ($label =~ /^(\d+)-/) { $start = $1; $end = $start + 100 - 1; } elsif ($label =~ /^(\d+)/) { $start = $1; $end = $1; } else { $start = 1; $end = $lines; } $head = "■掲示板に戻る■\n"; $head .= "全部\n"; for (0 .. ($lines - 1) / 100) { $n = $_ * 100 + 1; $head .= "$n-\n"; } $head .= "最新50\n"; print <) { s/\r?\n$//; ($name, $mail, $date, $_, $title) = split(/\<\>/); if ($i == 1) { if (!$title) { print < $QUERY_STRING EOF unlink($tmp); exit } print <$title $head

$title

EOF } if ($mail) { $name = "$name"; } s@http://ime.nu/@http://@g; s@(h?ttp:)([#-~]+)@"$1$2"@ge; s@(ftp:[#-~]+)@$1@g; s@= $start && $i <= $end)) { print <$i :$name:$date
$_

EOF } $i++; } print <


EOF sub link { local($_) = @_; if (m@/test/read.cgi/@) { return "$CGI?$_"; } return $_; } sub subback { $dat = $_; s@http://@@ || exit; $tmp = $ENV{"HOME"} . "/.w3m2ch/$_"; $dat =~ s/([^\w\/.\:\-])/\\$1/g; $tmp =~ s/([^\w\/.\:\-])/\\$1/g; ($dir = $tmp) =~ s@/[^/]+$@@; $cmd = "mkdir -p $dir; $WGET -O $tmp $dat >/dev/null 2>&1"; system $cmd; print <) { if (/