Re: CVS commit: src/games/wtf

2018-08-16 Thread Hisashi T Fujinaka

On Thu, 16 Aug 2018, Joerg Sonnenberger wrote:


On Thu, Aug 16, 2018 at 02:18:37PM +, m...@netbsd.org wrote:

On Thu, Aug 16, 2018 at 03:41:59PM +0200, Joerg Sonnenberger wrote:

On Thu, Aug 16, 2018 at 01:31:04PM +, Maya Rashish wrote:

Module Name:src
Committed By:   maya
Date:   Thu Aug 16 13:31:04 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
Try freebsd's pkg-info as well

From John Hein, via Nikolai Lifanov. PR misc/52684


Why? What next, asking rpm or dpkg if someone installed them?


It's not premature-portability like you're implying.
It's coming from someone who has been sending countless of
patches and uses it on FreeBSD for real.
It's also like 5 lines of diff.


This is a *base system* program.


Yeah. I think that functionality should be in pkgsrc, which is funny
because then you'd need pkgsrc to get info on pkg-info.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE + BSChem + BAEnglish + MSCS + $2.50 = coffee


Re: CVS commit: src/games/wtf

2018-08-16 Thread Joerg Sonnenberger
On Thu, Aug 16, 2018 at 02:18:37PM +, m...@netbsd.org wrote:
> On Thu, Aug 16, 2018 at 03:41:59PM +0200, Joerg Sonnenberger wrote:
> > On Thu, Aug 16, 2018 at 01:31:04PM +, Maya Rashish wrote:
> > > Module Name:  src
> > > Committed By: maya
> > > Date: Thu Aug 16 13:31:04 UTC 2018
> > > 
> > > Modified Files:
> > >   src/games/wtf: wtf
> > > 
> > > Log Message:
> > > Try freebsd's pkg-info as well
> > > 
> > > From John Hein, via Nikolai Lifanov. PR misc/52684
> > 
> > Why? What next, asking rpm or dpkg if someone installed them?
> 
> It's not premature-portability like you're implying.
> It's coming from someone who has been sending countless of
> patches and uses it on FreeBSD for real.
> It's also like 5 lines of diff.

This is a *base system* program.

Joerg


Re: CVS commit: src/games/wtf

2018-08-16 Thread maya
On Thu, Aug 16, 2018 at 03:41:59PM +0200, Joerg Sonnenberger wrote:
> On Thu, Aug 16, 2018 at 01:31:04PM +, Maya Rashish wrote:
> > Module Name:src
> > Committed By:   maya
> > Date:   Thu Aug 16 13:31:04 UTC 2018
> > 
> > Modified Files:
> > src/games/wtf: wtf
> > 
> > Log Message:
> > Try freebsd's pkg-info as well
> > 
> > From John Hein, via Nikolai Lifanov. PR misc/52684
> 
> Why? What next, asking rpm or dpkg if someone installed them?

It's not premature-portability like you're implying.
It's coming from someone who has been sending countless of
patches and uses it on FreeBSD for real.
It's also like 5 lines of diff.


Re: CVS commit: src/games/wtf

2018-08-16 Thread Joerg Sonnenberger
On Thu, Aug 16, 2018 at 01:31:04PM +, Maya Rashish wrote:
> Module Name:  src
> Committed By: maya
> Date: Thu Aug 16 13:31:04 UTC 2018
> 
> Modified Files:
>   src/games/wtf: wtf
> 
> Log Message:
> Try freebsd's pkg-info as well
> 
> From John Hein, via Nikolai Lifanov. PR misc/52684

Why? What next, asking rpm or dpkg if someone installed them?

Joerg


CVS commit: src/games/wtf

2018-08-16 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Aug 16 13:31:04 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
Try freebsd's pkg-info as well

>From John Hein, via Nikolai Lifanov. PR misc/52684


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.24 src/games/wtf/wtf:1.25
--- src/games/wtf/wtf:1.24	Wed Mar  7 08:25:43 2018
+++ src/games/wtf/wtf	Thu Aug 16 13:31:04 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.24 2018/03/07 08:25:43 eadler Exp $
+#	$NetBSD: wtf,v 1.25 2018/08/16 13:31:04 maya Exp $
 #
 # Public domain
 #
@@ -96,6 +96,13 @@ for i; do
 		continue
 	fi
 
+	# Try pkg-info(1) next
+	ans="$(pkg info -qI "$i" 2> /dev/null)"
+	if [ $? -eq 0 ]; then
+		echo "$i: $ans"
+		continue
+	fi
+
 	# If called from pkgsrc package directory,
 	# try querying pkgsrc's help facility next
 	if [ -f ../../mk/bsd.pkg.mk ]; then



CVS commit: src/games/wtf

2018-08-16 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Aug 16 13:31:04 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
Try freebsd's pkg-info as well

>From John Hein, via Nikolai Lifanov. PR misc/52684


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2018-03-07 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Wed Mar  7 08:25:43 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
wtf(6): use character classes

ok pgoyette@ silence dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2018-03-07 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Wed Mar  7 08:25:43 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
wtf(6): use character classes

ok pgoyette@ silence dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.23 src/games/wtf/wtf:1.24
--- src/games/wtf/wtf:1.23	Wed Mar  7 08:24:16 2018
+++ src/games/wtf/wtf	Wed Mar  7 08:25:43 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.23 2018/03/07 08:24:16 eadler Exp $
+#	$NetBSD: wtf,v 1.24 2018/03/07 08:25:43 eadler Exp $
 #
 # Public domain
 #
@@ -74,7 +74,7 @@ done
 rv=0
 for i; do
 	# Search acronym list first
-	target="$(echo "$i" | tr '[a-z]' '[A-Z]')"
+  target="$(echo "$i" | tr '[:lower:]' '[:upper:]')"
 	ans="$(fgrep -h "$target" $acronyms 2>/dev/null \
 	 | sed -ne "\|^$target[[:space:]]|s|^$target[[:space:]]*||p")"
 	if [ -n "$ans" ] ; then



CVS commit: src/games/wtf

2018-03-07 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Wed Mar  7 08:24:16 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
wtf(6): quote "$f"

ok pgoyette@ silence dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.22 src/games/wtf/wtf:1.23
--- src/games/wtf/wtf:1.22	Wed Jan 17 03:03:59 2018
+++ src/games/wtf/wtf	Wed Mar  7 08:24:16 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.22 2018/01/17 03:03:59 pgoyette Exp $
+#	$NetBSD: wtf,v 1.23 2018/03/07 08:24:16 eadler Exp $
 #
 # Public domain
 #
@@ -65,7 +65,7 @@ fi
 
 
 for f in $acronyms; do
-	if [ ! -f $f ]; then
+	if [ ! -f "$f" ]; then
 		echo "$PROGNAME: cannot open acronym database file \`$f'" >&2
 		exit 1
 	fi



CVS commit: src/games/wtf

2018-03-07 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Wed Mar  7 08:24:16 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
wtf(6): quote "$f"

ok pgoyette@ silence dholland@


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2018-01-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jan 17 03:03:59 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
Don't skip the superfluous "is" argument if it's not superfluous!

This allows us to use `wtf is` and get information for the acronym "is"
and produces the same output as `wtf is is` withough requiring the extra
typing by the user.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.21 src/games/wtf/wtf:1.22
--- src/games/wtf/wtf:1.21	Tue Apr 21 23:56:30 2015
+++ src/games/wtf/wtf	Wed Jan 17 03:03:59 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.21 2015/04/21 23:56:30 christos Exp $
+#	$NetBSD: wtf,v 1.22 2018/01/17 03:03:59 pgoyette Exp $
 #
 # Public domain
 #
@@ -30,7 +30,9 @@ done
 shift "$(expr "$OPTIND" - 1)"
 
 if [ "$1" = "is" ]; then
-	shift
+	if [ $# -gt 1 ] ; then
+		shift
+	fi
 fi
 
 if [ -z "$1" ]; then



CVS commit: src/games/wtf

2018-01-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jan 17 03:03:59 UTC 2018

Modified Files:
src/games/wtf: wtf

Log Message:
Don't skip the superfluous "is" argument if it's not superfluous!

This allows us to use `wtf is` and get information for the acronym "is"
and produces the same output as `wtf is is` withough requiring the extra
typing by the user.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2015-04-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr 22 14:00:46 UTC 2015

Modified Files:
src/games/wtf: wtf.6

Log Message:
Fix typo, remove trailing space.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2015-04-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 22 15:04:57 UTC 2015

Modified Files:
src/games/wtf: wtf.6

Log Message:
PR/49850: Nikolai Lifanov: Document acronyms-o


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2015-04-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 21 22:49:46 UTC 2015

Modified Files:
src/games/wtf: wtf wtf.6

Log Message:
Add -o flag.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/games/wtf/wtf
cvs rdiff -u -r1.16 -r1.17 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.19 src/games/wtf/wtf:1.20
--- src/games/wtf/wtf:1.19	Tue Nov 20 07:40:54 2012
+++ src/games/wtf/wtf	Tue Apr 21 18:49:46 2015
@@ -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

Index: src/games/wtf/wtf.6
diff -u src/games/wtf/wtf.6:1.16 src/games/wtf/wtf.6:1.17
--- src/games/wtf/wtf.6:1.16	Tue Nov 20 07:40:54 2012
+++ src/games/wtf/wtf.6	Tue Apr 21 18:49:46 2015
@@ -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 @@ Unlike this variable the
 .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 @@ default computer-related acronym databas
 .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



CVS commit: src/games/wtf

2015-04-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 21 22:49:46 UTC 2015

Modified Files:
src/games/wtf: wtf wtf.6

Log Message:
Add -o flag.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/games/wtf/wtf
cvs rdiff -u -r1.16 -r1.17 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2015-04-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 21 23:56:30 UTC 2015

Modified Files:
src/games/wtf: wtf

Log Message:
obey $ACRONYMDB like before


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.20 src/games/wtf/wtf:1.21
--- src/games/wtf/wtf:1.20	Tue Apr 21 18:49:46 2015
+++ src/games/wtf/wtf	Tue Apr 21 19:56:30 2015
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.20 2015/04/21 22:49:46 christos Exp $
+#	$NetBSD: wtf,v 1.21 2015/04/21 23:56:30 christos Exp $
 #
 # Public domain
 #
@@ -51,6 +51,8 @@ if [ -z $acronyms ]; then
 ;;
 			esac
 		done
+	else
+		acronyms=$ACRONYMDB
 	fi
 fi
 



CVS commit: src/games/wtf

2015-04-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 21 23:56:30 UTC 2015

Modified Files:
src/games/wtf: wtf

Log Message:
obey $ACRONYMDB like before


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2012-11-20 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Tue Nov 20 12:40:54 UTC 2012

Modified Files:
src/games/wtf: wtf wtf.6

Log Message:
PR/47178 from Bug Hunting

src/games/wtf/wtf:
- Correct `usage' (to match new `SYNOPSIS' from man page);
- augment comment on quering pkgsrc's help facility;
- correct interpretation of pkgsrc' help facility query result.

src/games/wtf/wtf.6:
- enhance `SYNOPSIS', document description (`.Dd'), and overal
  program description;
- augment description about quering pkgsrc's help facility;
- improve wording;
- augment `HISTORY' section;
- bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/games/wtf/wtf
cvs rdiff -u -r1.15 -r1.16 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.18 src/games/wtf/wtf:1.19
--- src/games/wtf/wtf:1.18	Wed Oct  3 19:50:06 2012
+++ src/games/wtf/wtf	Tue Nov 20 12:40:54 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.18 2012/10/03 19:50:06 wiz Exp $
+#	$NetBSD: wtf,v 1.19 2012/11/20 12:40:54 abs Exp $
 #
 # Public domain
 #
@@ -8,7 +8,7 @@
 PROGNAME=$(basename $0)
 
 usage() {
-	echo usage: $PROGNAME [-f dbfile] [is] acronym ...
+	echo usage: $PROGNAME [-f dbfile] [is] term ...
 	exit 1
 }
 
@@ -76,10 +76,11 @@ for i; do
 		continue
 	fi
 
-	# Try querying pkgsrc's help facility next
+	# If called from pkgsrc package directory,
+	# try querying pkgsrc's help facility next
 	if [ -f ../../mk/bsd.pkg.mk ]; then
 		ans=$(make help topic=$i)
-		if [ $? -eq 0 ]; then
+		if [ $ans != No help found for $i. ]; then
 			echo $i: $ans
 			continue
 		fi

Index: src/games/wtf/wtf.6
diff -u src/games/wtf/wtf.6:1.15 src/games/wtf/wtf.6:1.16
--- src/games/wtf/wtf.6:1.15	Wed Oct  3 19:50:43 2012
+++ src/games/wtf/wtf.6	Tue Nov 20 12:40:54 2012
@@ -1,41 +1,46 @@
-.\	$NetBSD: wtf.6,v 1.15 2012/10/03 19:50:43 wiz Exp $
+.\	$NetBSD: wtf.6,v 1.16 2012/11/20 12:40:54 abs Exp $
 .\
 .\ Public Domain
 .\
-.Dd October 3, 2012
+.Dd November 20, 2012
 .Dt WTF 6
 .Os
 .Sh NAME
 .Nm wtf
-.Nd translate acronyms
+.Nd look up terms
 .Sh SYNOPSIS
 .Nm
 .Op Fl f Ar dbfile
 .Op Ar is
-.Ar acronym ...
+.Ar term ...
 .Sh DESCRIPTION
 The
 .Nm
-utility displays the expansion of one or more acronyms
-specified on the command line.
-If an acronym is not in any of the acronym databases,
+utility looks up the meaning of one or more
+.Ar term
+operands specified on the command line.
+.Pp
+.Ar term
+will first be searched for as an acronym in the acronym databases,
 which are expected to be in the format
-.Dq acronym[tab]meaning ,
+.Dq acronym[tab]meaning .
+If no match has been found,
 .Nm
-will check to see if it is known by
+will check to see if the term is known by
 .Xr whatis 1 ,
 .Xr pkg_info 1 ,
-or via pkgsrc's internal help mechanism,
+or, when called from within a pkgsrc package directory,
+pkgsrc's internal help facility,
 .Dq make help topic=XXX .
 .Pp
-If
-.Dq is
-is specified on the command line, it will be ignored, allowing the
+The optional
+.Ar is
+operand will be ignored, allowing the
 fairly natural
 .Dq wtf is WTF
 usage.
 .Pp
-The following options are available:
+The following option is available:
 .Bl -tag -width flag
 .It Fl f Ar dbfile
 Overrides the default list of acronym databases, bypassing the value of the
@@ -70,3 +75,5 @@ default computer-related acronym databas
 .Nm
 first appeared in
 .Nx 1.5 .
+Initially it only translated acronyms;
+functionality to look up the meaning of terms in other sources was added later.



CVS commit: src/games/wtf

2012-11-20 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Tue Nov 20 12:40:54 UTC 2012

Modified Files:
src/games/wtf: wtf wtf.6

Log Message:
PR/47178 from Bug Hunting

src/games/wtf/wtf:
- Correct `usage' (to match new `SYNOPSIS' from man page);
- augment comment on quering pkgsrc's help facility;
- correct interpretation of pkgsrc' help facility query result.

src/games/wtf/wtf.6:
- enhance `SYNOPSIS', document description (`.Dd'), and overal
  program description;
- augment description about quering pkgsrc's help facility;
- improve wording;
- augment `HISTORY' section;
- bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/games/wtf/wtf
cvs rdiff -u -r1.15 -r1.16 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2012-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct  3 19:50:07 UTC 2012

Modified Files:
src/games/wtf: wtf

Log Message:
- correct `usage' message;
- improve wording.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.17 src/games/wtf/wtf:1.18
--- src/games/wtf/wtf:1.17	Thu Apr 26 03:16:13 2012
+++ src/games/wtf/wtf	Wed Oct  3 19:50:06 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.17 2012/04/26 03:16:13 christos Exp $
+#	$NetBSD: wtf,v 1.18 2012/10/03 19:50:06 wiz Exp $
 #
 # Public domain
 #
@@ -8,7 +8,7 @@
 PROGNAME=$(basename $0)
 
 usage() {
-	echo Usage: $PROGNAME [-f dbfile] [is] acronym
+	echo usage: $PROGNAME [-f dbfile] [is] acronym ...
 	exit 1
 }
 
@@ -39,21 +39,21 @@ if [ -z $acronyms ]; then
 fi
 
 if [ -z $acronyms ]; then
-	echo $PROGNAME: acronyms database not found! 2
+	echo $PROGNAME: acronym 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
+		echo $PROGNAME: cannot open acronym database file \`$f' 2
 		exit 1
 	fi
 done
 
 rv=0
 for i; do
-	# Search acronyms list first
+	# Search acronym list first
 	target=$(echo $i | tr '[a-z]' '[A-Z]')
 	ans=$(fgrep -h $target $acronyms 2/dev/null \
 	 | sed -ne \|^$target[[:space:]]|s|^$target[[:space:]]*||p)



CVS commit: src/games/wtf

2012-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct  3 19:50:11 UTC 2012

Modified Files:
src/games/wtf: wtf.6

Log Message:
- improve wording and overall program description (notably for `-f');
- improve macro usage;
- bump date.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf.6
diff -u src/games/wtf/wtf.6:1.13 src/games/wtf/wtf.6:1.14
--- src/games/wtf/wtf.6:1.13	Mon May  4 20:37:28 2009
+++ src/games/wtf/wtf.6	Wed Oct  3 19:50:11 2012
@@ -1,26 +1,28 @@
-.\	$NetBSD: wtf.6,v 1.13 2009/05/04 20:37:28 wiz Exp $
+.\	$NetBSD: wtf.6,v 1.14 2012/10/03 19:50:11 wiz Exp $
 .\
 .\ Public Domain
 .\
-.Dd July 27, 2007
+.Dd September 25, 2012
 .Dt WTF 6
 .Os
 .Sh NAME
 .Nm wtf
-.Nd translates acronyms for you
+.Nd translate acronyms
 .Sh SYNOPSIS
 .Nm
 .Op Fl f Ar dbfile
 .Op Ar is
-.Ar acronym Ar ...
+.Ar acronym ...
 .Sh DESCRIPTION
 The
 .Nm
-utility displays the expansion of the acronyms
+utility displays the expansion of one or more acronyms
 specified on the command line.
-If the acronym is not in any of the acronyms databases,
+If an acronym is not in any of the acronym databases,
+which are expected to be in the format
+.Dq acronym[tab]meaning ,
 .Nm
-will check to see if the acronym is known by
+will check to see if it is known by
 .Xr whatis 1 ,
 .Xr pkg_info 1 ,
 or via pkgsrc's internal help mechanism,
@@ -36,26 +38,29 @@ usage.
 The following options are available:
 .Bl -tag -width flag
 .It Fl f Ar dbfile
-Overrides the default acronym database, bypassing the value of the
+Overrides the default list of acronym databases, bypassing the value of the
 .Ev ACRONYMDB
 variable.
+Unlike this variable the
+.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.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width ACRONYMDB
 .It Ev ACRONYMDB
-The default acronym database may be overridden by setting the
+The default list of acronym databases may be overridden by setting the
 environment variable
 .Ev ACRONYMDB
 to the name of one or more space-separated file names of
 acronym databases.
-The files must be in the proper format (acronym[tab]meaning).
 .El
 .Sh FILES
 .Bl -tag -width /usr/share/misc/acronyms. -compact
 .It Pa /usr/share/misc/acronyms
 default acronym database.
 .It Pa /usr/share/misc/acronyms.comp
-computer-related acronym database.
+default computer-related acronym database.
 .El
 .Sh SEE ALSO
 .Xr make 1 ,



CVS commit: src/games/wtf

2012-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct  3 19:50:43 UTC 2012

Modified Files:
src/games/wtf: wtf.6

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf.6
diff -u src/games/wtf/wtf.6:1.14 src/games/wtf/wtf.6:1.15
--- src/games/wtf/wtf.6:1.14	Wed Oct  3 19:50:11 2012
+++ src/games/wtf/wtf.6	Wed Oct  3 19:50:43 2012
@@ -1,8 +1,8 @@
-.\	$NetBSD: wtf.6,v 1.14 2012/10/03 19:50:11 wiz Exp $
+.\	$NetBSD: wtf.6,v 1.15 2012/10/03 19:50:43 wiz Exp $
 .\
 .\ Public Domain
 .\
-.Dd September 25, 2012
+.Dd October 3, 2012
 .Dt WTF 6
 .Os
 .Sh NAME



CVS commit: src/games/wtf

2012-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct  3 19:50:07 UTC 2012

Modified Files:
src/games/wtf: wtf

Log Message:
- correct `usage' message;
- improve wording.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2012-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct  3 19:50:11 UTC 2012

Modified Files:
src/games/wtf: wtf.6

Log Message:
- improve wording and overall program description (notably for `-f');
- improve macro usage;
- bump date.

From Bug Hunting.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2012-10-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Oct  3 19:50:43 UTC 2012

Modified Files:
src/games/wtf: wtf.6

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2012-04-25 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Thu Apr 26 01:55:14 UTC 2012

Modified Files:
src/games/wtf: wtf

Log Message:
allow multiple '-f acronyms' arguments to be given, which makes this behave
more consistently with ACRONYMSDB, which may also point to multiple files


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.15 src/games/wtf/wtf:1.16
--- src/games/wtf/wtf:1.15	Mon Aug  6 21:14:36 2007
+++ src/games/wtf/wtf	Thu Apr 26 01:55:14 2012
@@ -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



CVS commit: src/games/wtf

2012-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 26 03:16:13 UTC 2012

Modified Files:
src/games/wtf: wtf

Log Message:
use modern shell constructs


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf
diff -u src/games/wtf/wtf:1.16 src/games/wtf/wtf:1.17
--- src/games/wtf/wtf:1.16	Wed Apr 25 21:55:14 2012
+++ src/games/wtf/wtf	Wed Apr 25 23:16:13 2012
@@ -1,53 +1,50 @@
 #!/bin/sh
 #
-#	$NetBSD: wtf,v 1.16 2012/04/26 01:55:14 jschauma Exp $
+#	$NetBSD: wtf,v 1.17 2012/04/26 03:16:13 christos Exp $
 #
 # Public domain
 #
 
-PROGNAME=`basename $0`
+PROGNAME=$(basename $0)
 
 usage() {
-	echo usage: $PROGNAME [-f dbfile] [is] acronym
+	echo Usage: $PROGNAME [-f dbfile] [is] acronym
 	exit 1
 }
 
-args=`getopt f: $*`
-if [ $? -ne 0 ]; then
-	usage
-fi
-set -- $args
-while [ $# -gt 0 ]; do
-	case $1 in
-		-f)
-			acronyms=$2 $acronyms; shift
-			;;
-		--)
-			shift; break
-			;;
+while getopts f: f
+do
+	case $f in
+	f)
+		acronyms=$OPTARG $acronyms
+		;;
+	*)
+		usage
+		;;
 	esac
-	shift
 done
 
-if [ $1 = is ] ; then
+shift $(expr $OPTIND - 1)
+
+if [ $1 = is ]; then
 	shift
 fi
 
-if [ $# -lt 1 ] ; then
+if [ -z $1 ]; then
 	usage
 fi
 
-if [ $acronyms =  ]; then
-	acronyms=${ACRONYMDB:-`ls /usr/share/misc/acronyms* 2/dev/null`}
+if [ -z $acronyms ]; then
+	acronyms=${ACRONYMDB:-$(ls /usr/share/misc/acronyms* 2/dev/null)}
 fi
 
-if [ $acronyms =  ]; then
+if [ -z $acronyms ]; then
 	echo $PROGNAME: acronyms database not found! 2
 	exit 1
 fi
 
 
-for f in $acronyms ; do
+for f in $acronyms; do
 	if [ ! -f $f ]; then
 		echo $PROGNAME: cannot open acronyms database file \`$f' 2
 		exit 1
@@ -55,43 +52,41 @@ for f in $acronyms ; do
 done
 
 rv=0
-while [ $# -gt 0 ] ; do
+for i; do
 	# Search acronyms list first
-	target=`echo $1 | tr '[a-z]' '[A-Z]'`
-	ans=`fgrep -h $target $acronyms 2/dev/null \
-	 | sed -ne \|^$target[[:space:]]|s|^$target[[:space:]]*||p`
-	if [ $ans !=  ] ; then
+	target=$(echo $i | tr '[a-z]' '[A-Z]')
+	ans=$(fgrep -h $target $acronyms 2/dev/null \
+	 | sed -ne \|^$target[[:space:]]|s|^$target[[:space:]]*||p)
+	if [ -n $ans ] ; then
 		echo $target: $ans
-		shift ; continue
+		continue
 	fi
 
 	# Try whatis(1) next
-	ans=`whatis $1 2/dev/null`
-	if [ $? -eq 0 ] ; then
+	ans=$(whatis $i 2/dev/null)
+	if [ $? -eq 0 ]; then
 		echo $ans | sort -u
-		shift ; continue
+		continue
 	fi
 
 	# Try pkg_info(1) next
-	ans=`pkg_info -qc $1 2 /dev/null`
-	if [ $? -eq 0 ] ; then
-		echo $1: $ans
-		shift ; continue
+	ans=$(pkg_info -qc $i 2 /dev/null)
+	if [ $? -eq 0 ]; then
+		echo $i: $ans
+		continue
 	fi
 
 	# Try querying pkgsrc's help facility next
-	if [ -f ../../mk/bsd.pkg.mk ] ; then
-		ans=`make help topic=$1`
-		if [ $? -eq 0 ] ; then
-			echo $1: $ans
-			shift ; continue
+	if [ -f ../../mk/bsd.pkg.mk ]; then
+		ans=$(make help topic=$i)
+		if [ $? -eq 0 ]; then
+			echo $i: $ans
+			continue
 		fi
 	fi
 
 	# Give up!
-	echo $PROGNAME: I don't know what $1 means! 12
+	echo $PROGNAME: I don't know what \`$i' means! 12
 	rv=1
-	
-	shift
 done
 exit $rv



CVS commit: src/games/wtf

2012-04-25 Thread Jan Schaumann
Module Name:src
Committed By:   jschauma
Date:   Thu Apr 26 01:55:14 UTC 2012

Modified Files:
src/games/wtf: wtf

Log Message:
allow multiple '-f acronyms' arguments to be given, which makes this behave
more consistently with ACRONYMSDB, which may also point to multiple files


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2012-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 26 03:16:13 UTC 2012

Modified Files:
src/games/wtf: wtf

Log Message:
use modern shell constructs


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/games/wtf/wtf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/wtf

2009-05-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon May  4 20:37:28 UTC 2009

Modified Files:
src/games/wtf: wtf.6

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/games/wtf/wtf.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/wtf/wtf.6
diff -u src/games/wtf/wtf.6:1.12 src/games/wtf/wtf.6:1.13
--- src/games/wtf/wtf.6:1.12	Mon Aug  6 21:14:37 2007
+++ src/games/wtf/wtf.6	Mon May  4 20:37:28 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: wtf.6,v 1.12 2007/08/06 21:14:37 hubertf Exp $
+.\	$NetBSD: wtf.6,v 1.13 2009/05/04 20:37:28 wiz Exp $
 .\
 .\ Public Domain
 .\
@@ -20,7 +20,7 @@
 specified on the command line.
 If the acronym is not in any of the acronyms databases,
 .Nm
-will check to see if the acronym is known by 
+will check to see if the acronym is known by
 .Xr whatis 1 ,
 .Xr pkg_info 1 ,
 or via pkgsrc's internal help mechanism,