summaryrefslogtreecommitdiffstats
path: root/wtf/wtf
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2015-04-21 22:49:46 +0000
committerchristos <christos@NetBSD.org>2015-04-21 22:49:46 +0000
commit6964041e632816e3592ce3131b3d5d66022236c4 (patch)
tree5cd87e8ce0f1b0c5972d6e24ccd02cf52c7ddf22 /wtf/wtf
parentc4603743ccc0f70f98eb4d0436538a134cacb765 (diff)
downloadbsdgames-darwin-6964041e632816e3592ce3131b3d5d66022236c4.tar.gz
bsdgames-darwin-6964041e632816e3592ce3131b3d5d66022236c4.tar.zst
bsdgames-darwin-6964041e632816e3592ce3131b3d5d66022236c4.zip
Add -o flag.
Diffstat (limited to 'wtf/wtf')
-rw-r--r--wtf/wtf24
1 files changed, 20 insertions, 4 deletions
diff --git a/wtf/wtf b/wtf/wtf
index 5972d7d6..41714b38 100644
--- a/wtf/wtf
+++ b/wtf/wtf
@@ -1,20 +1,23 @@
#!/bin/sh
#
-# $NetBSD: wtf,v 1.19 2012/11/20 12:40:54 abs Exp $
+# $NetBSD: wtf,v 1.20 2015/04/21 22:49:46 christos Exp $
#
# Public domain
#
PROGNAME="$(basename "$0")"
+offensive=false
usage() {
- echo "usage: $PROGNAME [-f dbfile] [is] term ..."
+ echo "usage: $PROGNAME [-o] [-f dbfile] [is] term ..."
exit 1
}
-while getopts f: f
+while getopts f:o f
do
case "$f" in
+ o) offensive=true
+ ;;
f)
acronyms="$OPTARG $acronyms"
;;
@@ -35,7 +38,20 @@ if [ -z "$1" ]; then
fi
if [ -z "$acronyms" ]; then
- acronyms=${ACRONYMDB:-$(ls /usr/share/misc/acronyms* 2>/dev/null)}
+ if [ -z "$ACRONYMDB" ]; then
+ for f in /usr/share/misc/acronyms*; do
+ case $f in
+ *-o)
+ if $offensive; then
+ acronyms="$acronyms $f"
+ fi
+ ;;
+ *)
+ acronyms="$acronyms $f"
+ ;;
+ esac
+ done
+ fi
fi
if [ -z "$acronyms" ]; then