/usr/lib/surfraw/leodict is in surfraw 2.2.9-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | #!/bin/sh
# elvis: leodict -- Search Leo's German <-> English dictionary (dict.leo.org)
# $Id$
# surfraw plugin for the biggest English/German dictionary on
# the WWW: dict.leo.org jmm@informatik.uni-bremen.de
# options added by Ian Beckwith <ianb@erislabs.net>
. surfraw || exit 1
w3_config_hook () {
defyn SURFRAW_leodict_link yes
defyn SURFRAW_leodict_head yes
defyn SURFRAW_leodict_grid yes
def SURFRAW_leodict_to "either"
def SURFRAW_leodict_spell "standard"
def SURFRAW_leodict_tol "standard"
def SURFRAW_leodict_lang "$SURFRAW_lang"
}
w3_parse_option_hook () {
opt="$1"
optarg="$2"
case "$opt" in
-link*=*) setopt SURFRAW_leodict_link $optarg ;;
-head*=*) setopt SURFRAW_leodict_head $optarg ;;
-grid*=*) setopt SURFRAW_leodict_grid $optarg ;;
-to=*) setopt SURFRAW_leodict_to $optarg ;;
-spell*=*) setopt SURFRAW_leodict_spell $optarg ;;
-tol*=*) setopt SURFRAW_leodict_tol $optarg ;;
-lang*=*) setopt SURFRAW_leodict_lang $optarg ;;
*) return 1 ;;
esac
return 0
}
w3_usage_hook () {
cat <<EOF
Usage: $w3_argv0 [search words]...
Description:
Surfraw search the German/English dictionary LEO (dict.leo.org)
Local options:
-to=de | en | either Language to translate to.
Default: $SURFRAW_leodict_to
Environment: SURFRAW_leodict_to
-lang=en | de Language web page is in.
Environment: SURFRAW_leodict_lang, SURFRAW_lang
If above variables are not set, defaults to en,
unless \$LANG is set and contains "de".
-link=on | off Link results.
Default: $SURFRAW_leodict_link
Environment: SURFRAW_leodict_link
-head=on | off Display headlines.
Default: $SURFRAW_leodict_head
Environment: SURFRAW_leodict_head
-grid=on | off Show results in grid.
Default: $SURFRAW_leodict_grid
Environment: SURFRAW_leodict_grid
-spell=off | standard | force Spelling tolerance
Default: $SURFRAW_leodict_spell
Environment: SURFRAW_leodict_spell
-tol=off | standard | high Special characters tolerance
Default: $SURFRAW_leodict_tol
Environment: SURFRAW_leodict_tol
EOF
w3_global_usage
}
w3_config
w3_parse_args "$@"
if test -z "$w3_args"; then
w3_browse_url "http://dict.leo.org/"
else
escaped_args=`w3_url_of_arg $w3_args`
url="http://dict.leo.org/?search=${escaped_args}"
case "$SURFRAW_leodict_lang" in
en|de) ;;
*) SURFRAW_leodict_lang=`perl -e 'if((exists($ENV{LANG})) && ($ENV{LANG}=~/de/i)) { print "de\n"; } else { print "en\n"; }'` ;;
esac
if yesno SURFRAW_leodict_link ; then url="$url&relink=on"
else url="$url&relink=off";fi
if yesno SURFRAW_leodict_head ; then url="$url§Hdr=on"
else url="$url§Hdr=off";fi
if yesno SURFRAW_leodict_grid ; then url="$url&tableBorder=1"
else url="$url&tableBorder=0";fi
if [ "$SURFRAW_leodict_to" = "de" ] ; then url="$url&searchLoc=-1"
elif [ "$SURFRAW_leodict_to" = "en" ] ; then url="$url&searchLoc=1"
else url="$url&searchLoc=0" ; fi
if [ "$SURFRAW_leodict_spell" = "off" ] ; then url="$url&spellToler=off"
elif [ "$SURFRAW_leodict_spell" = "force" ] ; then url="$url&spellToler=on"
else url="$url&spellToler=standard" ; fi
if [ "$SURFRAW_leodict_tol" = "high" ] ; then url="$url&cmpType=fuzzy"
elif [ "$SURFRAW_leodict_tol" = "off" ] ; then url="$url&cmpType=exact"
else url="$url&cmpType=relaxed" ; fi
url="$url&lang=$SURFRAW_leodict_lang"
w3_browse_url "$url"
fi
|