| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# ~/.w3m/urimethodmap |
| 4 |
# g: file:/cgi-bin/google.cgi?%s |
| 5 |
# google: file:/cgi-bin/google.cgi?%s |
| 6 |
|
| 7 |
$url = "http://www.google.com/"; |
| 8 |
$_ = $ENV{"QUERY_STRING"}; |
| 9 |
s@^g(oogle)?:@@ && s@^//@@ && s@/$@@; |
| 10 |
if ($_) { |
| 11 |
s/\+/ /g; |
| 12 |
s/%([\da-f][\da-f])/pack('C', hex($1))/egi; |
| 13 |
s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg; |
| 14 |
$url .= "search?q=$_&hl=ja&lr=lang_ja&ie=EUC-JP"; |
| 15 |
} else { |
| 16 |
$input = "w3m-control: GOTO_LINK"; |
| 17 |
} |
| 18 |
print <<EOF; |
| 19 |
w3m-control: GOTO $url |
| 20 |
w3m-control: DELETE_PREVBUF |
| 21 |
w3m-control: SEARCH \\[ |
| 22 |
w3m-control: MOVE_RIGHT |
| 23 |
${input} |
| 24 |
|
| 25 |
EOF |