#!/usr/local/bin/perl -w $lynx = '/usr/home/kuni/bin/lynx'; $nkf = '/usr/home/kuni/bin/nkf'; $url = ''; $debug = ''; if (defined($ENV{'REQUEST_METHOD'})) { if ($ENV{'REQUEST_METHOD'} eq "POST"){ read(STDIN, $in, $ENV{'CONTENT_LENGTH'}); } else { $in = $ENV{'QUERY_STRING'}; } @datas = split(/&/, $in); foreach $data (@datas){ ($name, $val) = split(/=/, $data); $val =~ tr/+/ /; $val =~ s/%([a-f0-9]{2})/pack("C", hex($1))/egi; $form{$name} = $val; } for $k (sort keys(%form)) { $debug .= sprintf "\t\t%20.20s: [%s]
\n", $k, $form{$k}; if ($k eq 'url') { $url = $form{$k}; } } } elsif (@ARGV > 0) { $url = $ARGV[0] if defined $ARGV[0]; } else { print "content-type: text/plain\n\nargument is not found\n"; exit 0; } if (open(IN, "$lynx -source $url | $nkf |")) { undef $/; $in = ; close(IN); } else { print "content-type: text/plain\n\nlynx error\n"; exit 0; } $out = ''; while ($in =~ /(.*?)(\e\$B.*?\e\(B)(.*)/s) { #print "[$1][$2][$3]\n"; $out .= $1; $jis = $2; $in = $3; $jis =~ s/>/>/gs; $jis =~ s/</