Files
BSDGames/wtf/wtf.in
joey 51eabc017b copy in from cvs; cvs2svn fucked up big time
git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
2003-12-19 19:12:08 +00:00

37 lines
686 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: wtf,v 1.8 2003/02/06 15:17:01 salo Exp $
#
# Public domain
#
acronyms=${ACRONYMDB:-@wtf_acronymfile@}
if [ X"$1" = X"is" ] ; then
shift
fi
if [ $# -lt 1 ] ; then
echo "Usage: `basename $0` [is] <acronym>"
fi
rv=0
while [ $# -gt 0 ] ; do
target=`echo $1 | tr '[a-z]' '[A-Z]'`
ans=`fgrep $target < $acronyms 2>/dev/null \
| sed -ne "\|^$target[[:space:]]|s|^$target[[:space:]]*||p"`
if [ "$ans" != "" ] ; then
echo "$target: $ans"
else
ans=`whatis $1 2> /dev/null | egrep "^$1[, ]" 2> /dev/null`
if [ $? -eq 0 ] ; then
echo "$1: $ans"
else
echo "Gee... I don't know what $1 means..." 1>&2
rv=1
fi
fi
shift
done
exit $rv