]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - wtf/wtf
d1167a9cba77e0035c94636a52d2512c60a3f7f7
3 # $NetBSD: wtf,v 1.18 2012/10/03 19:50:06 wiz Exp $
8 PROGNAME
="$(basename "$0")"
11 echo "usage: $PROGNAME [-f dbfile] [is] <acronym> ..."
19 acronyms
="$OPTARG $acronyms"
27 shift "$(expr "$OPTIND" - 1)"
29 if [ "$1" = "is" ]; then
37 if [ -z "$acronyms" ]; then
38 acronyms
=${ACRONYMDB:-$(ls /usr/share/misc/acronyms* 2>/dev/null)}
41 if [ -z "$acronyms" ]; then
42 echo "$PROGNAME: acronym database not found!" >&2
47 for f
in $acronyms; do
49 echo "$PROGNAME: cannot open acronym database file \`$f'" >&2
56 # Search acronym list first
57 target
="$(echo "$i" | tr '[a-z]' '[A-Z]')"
58 ans
="$(fgrep -h "$target" $acronyms 2>/dev/null \
59 | sed -ne "\
|^
$target[[:space
:]]|s
|^
$target[[:space
:]]*||p
")"
60 if [ -n "$ans" ] ; then
66 ans
="$(whatis "$i" 2>/dev/null)"
72 # Try pkg_info(1) next
73 ans
="$(pkg_info -qc "$i" 2> /dev/null)"
79 # Try querying pkgsrc's help facility next
80 if [ -f ..
/..
/mk
/bsd.pkg.mk
]; then
81 ans
="$(make help topic="$i")"
89 echo "$PROGNAME: I don't know what \`$i' means!" 1>&2