goodict.cgi (839B)
1 #!/usr/bin/perl 2 3 # ~/.w3m/urimethodmap 4 # e: file:/cgi-bin/goodict.cgi?%s 5 # w: file:/cgi-bin/goodict.cgi?%s 6 # j: file:/cgi-bin/goodict.cgi?%s 7 8 use NKF; 9 #$mode = 0; # substring 10 $mode = 1; # perfect match 11 #$mode = 3; # search body text 12 $url = "http://dictionary.goo.ne.jp"; 13 $_ = $ENV{"QUERY_STRING"}; 14 if (/^e:/) { 15 $kind = 'ej'; 16 } elsif (/^w:/) { 17 $kind = 'je'; 18 } elsif (/^j:/) { 19 $kind = 'jn'; 20 } 21 s@^[ewjs]:@@ && s@^//@@ && s@/$@@; 22 if ($_) { 23 s/\+/ /g; 24 s/%([\da-f][\da-f])/pack('C', hex($1))/egi; 25 $_ = nkf("-e", $_); 26 s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg; 27 $url .= "/search.php?MT=$_&kind=$kind&mode=$mode"; 28 } else { 29 $input = "w3m-control: GOTO_LINK"; 30 } 31 print <<EOF; 32 w3m-control: GOTO $url 33 w3m-control: DELETE_PREVBUF 34 w3m-control: SEARCH \\[ 35 w3m-control: MOVE_RIGHT 36 ${input} 37 38 EOF