3 # $NetBSD: wtf,v 1.14 2007/01/24 13:17:42 hubertf Exp $
11 echo "usage: $PROGNAME [-f dbfile] [is] <acronym>"
15 acronyms
=${ACRONYMDB:-`ls /usr/share/misc/acronyms* 2>/dev/null`}
17 if [ "$acronyms" = "" ]; then
18 echo "$PROGNAME: acronyms database not found!" >&2
27 while [ $# -gt 0 ]; do
39 if [ "$1" = "is" ] ; then
43 if [ $# -lt 1 ] ; then
50 echo "$PROGNAME: cannot open acronyms database file \`$f'" >&2
56 while [ $# -gt 0 ] ; do
57 # Search acronyms list first
58 target
=`echo $1 | tr '[a-z]' '[A-Z]'`
59 ans
=`fgrep -h $target $acronyms 2>/dev/null \
60 | sed -ne "\|^$target[[:space:]]|s|^$target[[:space:]]*||p"`
61 if [ "$ans" != "" ] ; then
67 ans
=`whatis $1 2>/dev/null`
68 if [ $?
-eq 0 ] ; then
73 # Try pkg_info(1) next
74 ans
=`pkg_info -qc $1 2> /dev/null`
75 if [ $?
-eq 0 ] ; then
80 # Try querying pkgsrc's help facility next
81 if [ -f ..
/..
/mk
/bsd.pkg.mk
] ; then
82 ans
=`make help topic="$1"`
83 if [ $?
-eq 0 ] ; then
90 echo "$PROGNAME: I don't know what $1 means!" 1>&2