This file is indexed.

/usr/bin/dict_lookup is in dict 1.12.1+dfsg-3.

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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh

# Copyright (c) 2010
#    Alexander Vorontsov <vorontsov@imb.invention-machine.com>
#    Aleksey Cheusov     <vle@gmx.net>
# 
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# 
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

############################################################
# Variables settable by user

#D_DICT_CMD=$HOME/bin/your-own-dict-program
D_AWK_PROG=${D_AWK_PROG-awk}
D_XCLIP_PROG=${D_XCLIP_PROG-xclip}
D_XTERM_PROG=${D_XTERM_PROG-xterm}
D_UTF8_LOCALE=${D_UTF8_LOCALE-`locale -a |fgrep .utf8 | head -n 1`}
D_DICT_PROG=${D_DICT_PROG-dict}
D_DICT_SERVER=${D_DICT_SERVER--h dict.org}
D_DICT_PORT=${D_DICT_PORT--p 2628}
D_DICT_DB_OPT=${D_DICT_DB_OPT--d foldoc}
D_XTERM_CLASS=${D_XTERM_CLASS--class XTerm}
D_XTERM_NAME=${D_XTERM_NAME--name xterm_dict}
D_XTERM_TITLE=${D_XTERM_TITLE--title dict_lookup}
D_TEXT_WIDTH=${D_TEXT_WIDTH-cyrillic_text_width}
D_TERM_X=${D_TERM_X-+200}
D_TERM_Y=${D_TERM_Y-+200}
D_TERM_H=${D_TERM_H-+40}
D_PAGER=${D_PAGER-less -R}

#if test -z "$COLORIZER"; then
#    colorit_config=$HOME/.colorit.d/dict
#    if test -f "$colorit_config"; then
	COLORIZER="colorit" # -P - -c $colorit_config"
#    else
#	COLORIZER=cat
#    fi
#fi

############################################################
# functions
#

cyrillic_text_width (){
    # This function may not work properly for languages
    # other than Russian. wcwidth(3) and C language is needed!
    LC_ALL=C $D_AWK_PROG -v h="$D_TERM_H" '
	BEGIN {max = 15}
	{ gsub(/[\300-\337][\200-\277]/, "1")
	  sub(/ +$/, "")
	  curr=length($0)
	  if (curr > max) max=curr
	}
	END { print max "x" (NR < h ? NR : h)+1}' "$@"
}

set_query ()
{
    if test -n "$query"; then
	return 0
    fi
    query=`$D_XCLIP_PROG -o`
    if test -z "$query"; then
	exit
    fi
}

check_system() {
  err=0
  for cmd in $D_XTERM_CMD $D_XCLIP_PROG; do
		if ! which "$cmd" > /dev/null; then
		missing="$missing $cmd"
	fi
  done

  if [ -n "$missing" ] ; then
	echo "Cannot find the following program(s) in the PATH: $missing"
	echo "Please install the appropriate package(s)."
	echo
	err=1
  fi


  if [ -z "$D_UTF8_LOCALE" ] ; then
	echo "Cannot find any UTF-8 locale installed on system."
	echo "Please run \`dpkg-reconfigure locales' and choose some UTF-8 locale."
	echo
	err=1
 fi

 [ "$err" = 0 ] || exit $err;
}


############################################################
# main
#

help (){
    cat 1>&2 <<'EOF'
usage: dict_lookup [OPTIONS]
   -h           display this help
   -x <x>       X coordinate of xterm
   -y <y>       Y coordinate of xterm
   -s <WxH>     size of xterm in symbols, e.g. 50x20
   -q <query>   query
EOF
}

while getopts x:y:s:q:h f
do
    case $f in
	h)      help; exit 0;;
	x)      D_TERM_X=+$OPTARG;;
	y)      D_TERM_Y=+$OPTARG;;
	s)      TERM_WH=$OPTARG;;
	q)      query=$OPTARG;;
	'?')    help; exit 1;;
    esac
done
shift `expr $OPTIND - 1`

check_system

set_query

tmp_dir=`mktemp -d`
test -d "$tmp_dir" || exit 1;
trap "rm -rf $tmp_dir" 0 1 2 3 15

if test -z "$D_DICT_CMD"; then
    D_DICT_CMD="$D_DICT_PROG $D_DICT_SERVER $D_DICT_PORT $D_DICT_DB_OPT"
fi

$D_DICT_CMD "$query" 2>&1 |
env LC_ALL=C grep -Ev "definitions? found" > "$tmp_dir/res.txt"

if test -z "$TERM_WH"; then
    TERM_WH=`$D_TEXT_WIDTH "$tmp_dir/res.txt"`
fi

geometry="-geometry ${TERM_WH}${D_TERM_X}${D_TERM_Y}"

unset LC_ALL || true
unset LANG || true
LC_CTYPE=$D_UTF8_LOCALE $D_XTERM_PROG $geometry \
    -u8 $D_XTERM_CLASS $D_XTERM_NAME $D_XTERM_TITLE \
    -e "$COLORIZER < $tmp_dir/res.txt | $D_PAGER"