NetBSD/games/wtf/wtf
sommerfeld 7e9fe5fb1e Fix the part of pr8201 which is IMHO a bug: the error message now goes
to stderr.

The existing error message ("I don't know what xxx means") is
unchanged, as it is stylisticly in keeping with the light-hearted
nature of the program, and is also more likely to be accurate than the
"no such acronym" error message proposed in 8201.
1999-08-13 03:02:06 +00:00

37 lines
660 B
Bash

#!/bin/sh
#
# $NetBSD: wtf,v 1.5 1999/08/13 03:02:06 sommerfeld Exp $
#
# Public domain
#
acronyms=${ACRONYMDB:-/usr/share/misc/acronyms}
if [ X"$1" = X"is" ] ; then
shift
fi
if [ $# -lt 1 ] ; then
echo "Usage: $0 [is] <acronym>"
fi
rv=0
while [ $# -gt 0 ] ; do
target=`echo $1 | tr '[a-z]' '[A-Z]'`
ans=`sed -ne "/^$target[[:space:]]/s/^$target[[:space:]]*//p" \
< $acronyms 2>/dev/null`
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