summaryrefslogtreecommitdiffstats
path: root/wtf
diff options
context:
space:
mode:
authorjmmv <jmmv@NetBSD.org>2003-04-10 09:18:24 +0000
committerjmmv <jmmv@NetBSD.org>2003-04-10 09:18:24 +0000
commitfccb30965075ce7ec03072acaa9000980e9a0d1c (patch)
tree6d697bee9f374e748932c038a951806f0c3e9883 /wtf
parent13460438155cb93b77a6a4ebb63b9093d85a04bf (diff)
downloadbsdgames-darwin-fccb30965075ce7ec03072acaa9000980e9a0d1c.tar.gz
bsdgames-darwin-fccb30965075ce7ec03072acaa9000980e9a0d1c.tar.zst
bsdgames-darwin-fccb30965075ce7ec03072acaa9000980e9a0d1c.zip
Implement the `-f' command line option to specify which acronyms database
to use. Overrides ACRONYMDB's value, if given.
Diffstat (limited to 'wtf')
-rw-r--r--wtf/wtf31
-rw-r--r--wtf/wtf.613
2 files changed, 40 insertions, 4 deletions
diff --git a/wtf/wtf b/wtf/wtf
index 92393e7c..b1c63546 100644
--- a/wtf/wtf
+++ b/wtf/wtf
@@ -1,18 +1,45 @@
#!/bin/sh
#
-# $NetBSD: wtf,v 1.8 2003/02/06 15:17:01 salo Exp $
+# $NetBSD: wtf,v 1.9 2003/04/10 09:18:24 jmmv Exp $
#
# Public domain
#
+usage() {
+ echo "usage: `basename $0` [-f dbfile] [is] <acronym>"
+ exit 1
+}
+
acronyms=${ACRONYMDB:-/usr/share/misc/acronyms}
+args=`getopt f: $*`
+if [ $? -ne 0 ]; then
+ usage
+fi
+set -- $args
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -f)
+ acronyms=$2; shift
+ ;;
+ --)
+ shift; break
+ ;;
+ esac
+ shift
+done
+
if [ X"$1" = X"is" ] ; then
shift
fi
if [ $# -lt 1 ] ; then
- echo "Usage: `basename $0` [is] <acronym>"
+ usage
+fi
+
+if [ ! -f $acronyms ]; then
+ echo "wtf: cannot open acronyms database file \`$acronyms'"
+ exit 1
fi
rv=0
diff --git a/wtf/wtf.6 b/wtf/wtf.6
index 622e393e..b93e4955 100644
--- a/wtf/wtf.6
+++ b/wtf/wtf.6
@@ -1,8 +1,8 @@
-.\" $NetBSD: wtf.6,v 1.5 2002/09/26 16:12:44 wiz Exp $
+.\" $NetBSD: wtf.6,v 1.6 2003/04/10 09:18:24 jmmv Exp $
.\"
.\" Public Domain
.\"
-.Dd July 21, 1999
+.Dd April 9, 2003
.Dt WTF 6
.Os
.Sh NAME
@@ -10,6 +10,7 @@
.Nd translates acronyms for you
.Sh SYNOPSIS
.Nm
+.Op Fl f Ar dbfile
.Op Ar is
.Ar acronym Ar ...
.Sh DESCRIPTION
@@ -29,6 +30,14 @@ is specified on the command line, it will be ignored, allowing the
fairly natural
.Dq wtf is WTF
usage.
+.Pp
+The following options are available:
+.Bl -tag -width flag
+.It Fl f Ar dbfile
+Overrides the default acronym database, bypassing the value of the
+.Ev ACRONYMDB
+variable.
+.El
.Sh ENVIRONMENT
.Bl -tag -width ACRONYMDB
.It Ev ACRONYMDB