From fccb30965075ce7ec03072acaa9000980e9a0d1c Mon Sep 17 00:00:00 2001 From: jmmv Date: Thu, 10 Apr 2003 09:18:24 +0000 Subject: Implement the `-f' command line option to specify which acronyms database to use. Overrides ACRONYMDB's value, if given. --- wtf/wtf | 31 +++++++++++++++++++++++++++++-- wtf/wtf.6 | 13 +++++++++++-- 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] " + 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] " + 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 -- cgit v1.2.3