From jamie@bishopston.net  Tue Jan 25 18:02:07 2011
Return-Path: <jamie@bishopston.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E8AFD106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Jan 2011 18:02:07 +0000 (UTC)
	(envelope-from jamie@bishopston.net)
Received: from pacha.mail.bishopston.net (pacha.mail.bishopston.net [66.148.74.41])
	by mx1.freebsd.org (Postfix) with ESMTP id AD7808FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Jan 2011 18:02:07 +0000 (UTC)
Received: from catflap.bishopston.net (jamie@localhost [127.0.0.1])
	by catflap.bishopston.net (8.14.4/8.14.3) with ESMTP id p0PI0pKH006245
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Jan 2011 18:00:51 GMT
	(envelope-from jamie@catflap.bishopston.net)
Received: (from jamie@localhost)
	by catflap.bishopston.net (8.14.4/8.12.9/Submit) id p0PI0pcJ006241;
	Tue, 25 Jan 2011 18:00:51 GMT
Message-Id: <201101251800.p0PI0pcJ006241@catflap.bishopston.net>
Date: Tue, 25 Jan 2011 18:00:51 GMT
From: Jamie Landeg Jones <jamie@bishopston.net>
Reply-To: Jamie Landeg Jones <jamie@bishopston.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Typing error in demo script inside man page "getopt(1)"
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         154289
>Category:       docs
>Synopsis:       Typing error in demo script inside man page "getopt(1)"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    uqs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 25 18:10:11 UTC 2011
>Closed-Date:    Wed Jan 26 18:43:46 UTC 2011
>Last-Modified:  Sun Feb 13 19:10:12 UTC 2011
>Originator:     Jamie Landeg Jones
>Release:        FreeBSD 8.2-PRERELEASE i386
>Organization:
http://www.bishopston.com/jamie/
>Environment:
System: FreeBSD catflap.bishopston.net 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Wed Jan 19 12:51:26 GMT 2011 root@catflap.bishopston.net:/usr/obj/usr/src/sys/CATFLAP i386


	
>Description:
	

	getopt(1) man page contains the following within the sample code:

                           -a|-b)
                                   echo flag $i set; sflags="${i#-}$sflags";
                                   shift;;
                           -o)

$i and ${i are wrong - they should be $1 and ${1 respectively - as it stands, the example doesn't show which flag is being set

>How-To-Repeat:

	man getopt
>Fix:

replace $i with $1 and ${i with ${1


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->uqs 
Responsible-Changed-By: uqs 
Responsible-Changed-When: Wed Jan 26 18:32:44 UTC 2011 
Responsible-Changed-Why:  
I'll take it 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154289 
State-Changed-From-To: open->closed 
State-Changed-By: uqs 
State-Changed-When: Wed Jan 26 18:43:15 UTC 2011 
State-Changed-Why:  
Committed in r217890, thanks for the submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154289 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/154289: commit references a PR
Date: Wed, 26 Jan 2011 18:43:21 +0000 (UTC)

 Author: uqs
 Date: Wed Jan 26 18:43:15 2011
 New Revision: 217890
 URL: http://svn.freebsd.org/changeset/base/217890
 
 Log:
   Fix typo in example getopt(1) script: $i vs $1 [1]
   While here apply style hammer.
   
   PR:		docs/154289 [1]
   Submitted by:	Jamie Landeg Jones <jamie@bishopston.net>
   MFC after:	1 week
 
 Modified:
   head/usr.bin/getopt/getopt.1
 
 Modified: head/usr.bin/getopt/getopt.1
 ==============================================================================
 --- head/usr.bin/getopt/getopt.1	Wed Jan 26 18:03:03 2011	(r217889)
 +++ head/usr.bin/getopt/getopt.1	Wed Jan 26 18:43:15 2011	(r217890)
 @@ -1,6 +1,6 @@
  .\" $FreeBSD$
  .\"
 -.Dd July 7, 2010
 +.Dd January 26, 2011
  .Dt GETOPT 1
  .Os
  .Sh NAME
 @@ -54,8 +54,7 @@ which requires an argument.
  args=\`getopt abo: $*\`
  # you should not use \`getopt abo: "$@"\` since that would parse
  # the arguments differently from what the set command below does.
 -if [ $? -ne 0 ]
 -then
 +if [ $? -ne 0 ]; then
  	echo 'Usage: ...'
  	exit 2
  fi
 @@ -63,22 +62,23 @@ set \-\- $args
  # You cannot use the set command with a backquoted getopt directly,
  # since the exit code from getopt would be shadowed by those of set,
  # which is zero by definition.
 -while true;
 -do
 -	case "$1"
 -	in
 -		\-a|\-b)
 -			echo flag $i set; sflags="${i#-}$sflags";
 -			shift;;
 -		\-o)
 -			echo oarg is "'"$2"'"; oarg="$2"; shift;
 -			shift;;
 -		\-\-)
 -			shift; break;;
 +while true; do
 +	case "$1" in
 +	\-a|\-b)
 +		echo "flag $1 set"; sflags="${1#-}$sflags"
 +		shift
 +		;;
 +	\-o)
 +		echo "oarg is '$2'"; oarg="$2"
 +		shift; shift
 +		;;
 +	\-\-)
 +		shift; break
 +		;;
  	esac
  done
 -echo single-char flags: "'"$sflags"'"
 -echo oarg is "'"$oarg"'"
 +echo "single-char flags: '$sflags'"
 +echo "oarg is '$oarg'"
  .Ed
  .Pp
  This code will accept any of the following as equivalent:
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/154289: commit references a PR
Date: Sun, 13 Feb 2011 19:02:32 +0000 (UTC)

 Author: uqs
 Date: Sun Feb 13 19:02:26 2011
 New Revision: 218656
 URL: http://svn.freebsd.org/changeset/base/218656
 
 Log:
   MFH r217890
   
   Fix typo in example getopt(1) script: $i vs $1 [1]
   While here apply style hammer.
   
   PR:		docs/154289 [1]
   Submitted by:	Jamie Landeg Jones <jamie@bishopston.net>
 
 Modified:
   stable/8/usr.bin/getopt/getopt.1
 Directory Properties:
   stable/8/usr.bin/getopt/   (props changed)
 
 Modified: stable/8/usr.bin/getopt/getopt.1
 ==============================================================================
 --- stable/8/usr.bin/getopt/getopt.1	Sun Feb 13 18:46:34 2011	(r218655)
 +++ stable/8/usr.bin/getopt/getopt.1	Sun Feb 13 19:02:26 2011	(r218656)
 @@ -1,6 +1,6 @@
  .\" $FreeBSD$
  .\"
 -.Dd July 7, 2010
 +.Dd January 26, 2011
  .Dt GETOPT 1
  .Os
  .Sh NAME
 @@ -55,8 +55,7 @@ which requires an argument.
  args=\`getopt abo: $*\`
  # you should not use \`getopt abo: "$@"\` since that would parse
  # the arguments differently from what the set command below does.
 -if [ $? -ne 0 ]
 -then
 +if [ $? -ne 0 ]; then
  	echo 'Usage: ...'
  	exit 2
  fi
 @@ -64,22 +63,23 @@ set \-\- $args
  # You cannot use the set command with a backquoted getopt directly,
  # since the exit code from getopt would be shadowed by those of set,
  # which is zero by definition.
 -while true;
 -do
 -	case "$1"
 -	in
 -		\-a|\-b)
 -			echo flag $i set; sflags="${i#-}$sflags";
 -			shift;;
 -		\-o)
 -			echo oarg is "'"$2"'"; oarg="$2"; shift;
 -			shift;;
 -		\-\-)
 -			shift; break;;
 +while true; do
 +	case "$1" in
 +	\-a|\-b)
 +		echo "flag $1 set"; sflags="${1#-}$sflags"
 +		shift
 +		;;
 +	\-o)
 +		echo "oarg is '$2'"; oarg="$2"
 +		shift; shift
 +		;;
 +	\-\-)
 +		shift; break
 +		;;
  	esac
  done
 -echo single-char flags: "'"$sflags"'"
 -echo oarg is "'"$oarg"'"
 +echo "single-char flags: '$sflags'"
 +echo "oarg is '$oarg'"
  .Ed
  .Pp
  This code will accept any of the following as equivalent:
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/154289: commit references a PR
Date: Sun, 13 Feb 2011 19:07:26 +0000 (UTC)

 Author: uqs
 Date: Sun Feb 13 19:07:17 2011
 New Revision: 218657
 URL: http://svn.freebsd.org/changeset/base/218657
 
 Log:
   MFH r209772,217890
   
   Fix an error in the EXAMPLES section of getopt(1), which is based on
   the same fix present in NetBSD.
   
   Fix typo in example getopt(1) script: $i vs $1 [1]
   While here apply style hammer.
   
   PR:		docs/133118, docs/154289 [1]
   Submitted by:	Oleg A. Mamontov, Jamie Landeg Jones
 
 Modified:
   stable/7/usr.bin/getopt/getopt.1
 Directory Properties:
   stable/7/usr.bin/getopt/   (props changed)
 
 Modified: stable/7/usr.bin/getopt/getopt.1
 ==============================================================================
 --- stable/7/usr.bin/getopt/getopt.1	Sun Feb 13 19:02:26 2011	(r218656)
 +++ stable/7/usr.bin/getopt/getopt.1	Sun Feb 13 19:07:17 2011	(r218657)
 @@ -1,6 +1,6 @@
  .\" $FreeBSD$
  .\"
 -.Dd April 3, 1999
 +.Dd January 26, 2011
  .Dt GETOPT 1
  .Os
  .Sh NAME
 @@ -55,8 +55,7 @@ which requires an argument.
  args=\`getopt abo: $*\`
  # you should not use \`getopt abo: "$@"\` since that would parse
  # the arguments differently from what the set command below does.
 -if [ $? -ne 0 ]
 -then
 +if [ $? -ne 0 ]; then
  	echo 'Usage: ...'
  	exit 2
  fi
 @@ -64,22 +63,23 @@ set \-\- $args
  # You cannot use the set command with a backquoted getopt directly,
  # since the exit code from getopt would be shadowed by those of set,
  # which is zero by definition.
 -for i
 -do
 -	case "$i"
 -	in
 -		\-a|\-b)
 -			echo flag $i set; sflags="${i#-}$sflags";
 -			shift;;
 -		\-o)
 -			echo oarg is "'"$2"'"; oarg="$2"; shift;
 -			shift;;
 -		\-\-)
 -			shift; break;;
 +while true; do
 +	case "$1" in
 +	\-a|\-b)
 +		echo "flag $1 set"; sflags="${1#-}$sflags"
 +		shift
 +		;;
 +	\-o)
 +		echo "oarg is '$2'"; oarg="$2"
 +		shift; shift
 +		;;
 +	\-\-)
 +		shift; break
 +		;;
  	esac
  done
 -echo single-char flags: "'"$sflags"'"
 -echo oarg is "'"$oarg"'"
 +echo "single-char flags: '$sflags'"
 +echo "oarg is '$oarg'"
  .Ed
  .Pp
  This code will accept any of the following as equivalent:
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
