]> git.cameronkatri.com Git - bsdgames-darwin.git/commitdiff
allow multiple '-f acronyms' arguments to be given, which makes this behave
authorjschauma <jschauma@NetBSD.org>
Thu, 26 Apr 2012 01:55:14 +0000 (01:55 +0000)
committerjschauma <jschauma@NetBSD.org>
Thu, 26 Apr 2012 01:55:14 +0000 (01:55 +0000)
more consistently with ACRONYMSDB, which may also point to multiple files

wtf/wtf

diff --git a/wtf/wtf b/wtf/wtf
index 273d482bef15723b25a6e90476b5a19c735dbb61..22bb032574f74fb0dbd7cf6f814fd768e0a4f252 100644 (file)
--- a/wtf/wtf
+++ b/wtf/wtf
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: wtf,v 1.15 2007/08/06 21:14:36 hubertf Exp $
+#      $NetBSD: wtf,v 1.16 2012/04/26 01:55:14 jschauma Exp $
 #
 # Public domain
 #
@@ -12,13 +12,6 @@ usage() {
        exit 1
 }
 
-acronyms=${ACRONYMDB:-`ls /usr/share/misc/acronyms* 2>/dev/null`}
-
-if [ "$acronyms" = "" ]; then
-       echo "$PROGNAME: acronyms database not found!" >&2
-       exit 1
-fi
-
 args=`getopt f: $*`
 if [ $? -ne 0 ]; then
        usage
@@ -27,7 +20,7 @@ set -- $args
 while [ $# -gt 0 ]; do
        case "$1" in
                -f)
-                       acronyms=$2; shift
+                       acronyms="$2 $acronyms"; shift
                        ;;
                --)
                        shift; break
@@ -44,8 +37,17 @@ if [ $# -lt 1 ] ; then
        usage
 fi
 
-for f in $acronyms
-do
+if [ "$acronyms" = "" ]; then
+       acronyms=${ACRONYMDB:-`ls /usr/share/misc/acronyms* 2>/dev/null`}
+fi
+
+if [ "$acronyms" = "" ]; then
+       echo "$PROGNAME: acronyms database not found!" >&2
+       exit 1
+fi
+
+
+for f in $acronyms ; do
        if [ ! -f $f ]; then
                echo "$PROGNAME: cannot open acronyms database file \`$f'" >&2
                exit 1