Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/wtf Add -o flag.



details:   https://anonhg.NetBSD.org/src/rev/d6bf0e146d2b
branches:  trunk
changeset: 807777:d6bf0e146d2b
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 21 22:49:46 2015 +0000

description:
Add -o flag.

diffstat:

 games/wtf/wtf   |  24 ++++++++++++++++++++----
 games/wtf/wtf.6 |  15 ++++++++++++---
 2 files changed, 32 insertions(+), 7 deletions(-)

diffs (98 lines):

diff -r 9c4f8abea23c -r d6bf0e146d2b games/wtf/wtf
--- a/games/wtf/wtf     Tue Apr 21 22:41:32 2015 +0000
+++ b/games/wtf/wtf     Tue Apr 21 22:49:46 2015 +0000
@@ -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 @@
 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
diff -r 9c4f8abea23c -r d6bf0e146d2b games/wtf/wtf.6
--- a/games/wtf/wtf.6   Tue Apr 21 22:41:32 2015 +0000
+++ b/games/wtf/wtf.6   Tue Apr 21 22:49:46 2015 +0000
@@ -1,8 +1,8 @@
-.\"    $NetBSD: wtf.6,v 1.16 2012/11/20 12:40:54 abs Exp $
+.\"    $NetBSD: wtf.6,v 1.17 2015/04/21 22:49:46 christos Exp $
 .\"
 .\" Public Domain
 .\"
-.Dd November 20, 2012
+.Dd April 21, 2015
 .Dt WTF 6
 .Os
 .Sh NAME
@@ -11,6 +11,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl f Ar dbfile
+.Op Fl o
 .Op Ar is
 .Ar term ...
 .Sh DESCRIPTION
@@ -50,6 +51,13 @@
 .Fl f
 option only accepts one file name as an argument,
 but it may be given multiple times to specify more than one file to use.
+.It Fl o
+Include acronyms that could be considered offensive to some.
+Please consult
+.Xr forture 6
+for more information about the
+.Fl o 
+flag.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width ACRONYMDB
@@ -70,7 +78,8 @@
 .Sh SEE ALSO
 .Xr make 1 ,
 .Xr pkg_info 1 ,
-.Xr whatis 1
+.Xr whatis 1 ,
+.Xr fortune 6
 .Sh HISTORY
 .Nm
 first appeared in



Home | Main Index | Thread Index | Old Index