summaryrefslogtreecommitdiffstats
path: root/wtf/wtf
blob: 92393e7c5237c67e2dd7c79f0a12773d897f2675 (plain) (blame)
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
#!/bin/sh
#
#	$NetBSD: wtf,v 1.8 2003/02/06 15:17:01 salo Exp $
#
# Public domain
#

acronyms=${ACRONYMDB:-/usr/share/misc/acronyms}

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