Browse Source

typos from wiz@netbsd (including one from a PR from Quentin Garnier);

slight sync with NetBSD page;
ok millert@
OPENBSD_3_5
jmc 21 years ago
parent
commit
4662b6d15f
1 changed files with 14 additions and 10 deletions
  1. +14
    -10
      src/lib/libc/stdlib/getopt.3

+ 14
- 10
src/lib/libc/stdlib/getopt.3 View File

@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: getopt.3,v 1.26 2003/09/02 18:24:21 jmc Exp $
.\" $OpenBSD: getopt.3,v 1.27 2003/09/18 09:29:27 jmc Exp $
.\" .\"
.Dd December 17, 2002 .Dd December 17, 2002
.Dt GETOPT 3 .Dt GETOPT 3
@ -47,9 +47,11 @@ The
.Fn getopt .Fn getopt
function incrementally parses a command line argument list function incrementally parses a command line argument list
.Fa argv .Fa argv
and returns the next known option character.
and returns the next
.Em known
option character.
An option character is An option character is
.Dq known
.Em known
if it has been specified in the string of accepted option characters, if it has been specified in the string of accepted option characters,
.Fa optstring . .Fa optstring .
.Pp .Pp
@ -113,7 +115,7 @@ by the option
.Ql -- .Ql --
(double dash) which causes (double dash) which causes
.Fn getopt .Fn getopt
to signal the end of argument processing and returns \-1.
to signal the end of argument processing and return \-1.
When all options have been processed (i.e., up to the first non-option When all options have been processed (i.e., up to the first non-option
argument), argument),
.Fn getopt .Fn getopt
@ -134,9 +136,9 @@ it returns
If If
.Fa optstring .Fa optstring
has a leading has a leading
.Sq \:
.Sq \&:
then a missing option argument causes then a missing option argument causes
.Sq \:
.Sq \&:
to be returned instead of to be returned instead of
.Sq \&? . .Sq \&? .
In either case, the variable In either case, the variable
@ -147,6 +149,8 @@ The
function returns \-1 when the argument list is exhausted. function returns \-1 when the argument list is exhausted.
.Sh EXAMPLES .Sh EXAMPLES
.Bd -literal -compact .Bd -literal -compact
extern char *optarg;
extern int optind;
int bflag, ch, fd; int bflag, ch, fd;
bflag = 0; bflag = 0;
@ -174,7 +178,7 @@ argv += optind;
If the If the
.Fn getopt .Fn getopt
function encounters a character not found in the string function encounters a character not found in the string
.Va optstring
.Fa optstring
or detects or detects
a missing option argument it writes an error message to a missing option argument it writes an error message to
.Em stderr .Em stderr
@ -184,7 +188,7 @@ Setting
.Va opterr .Va opterr
to a zero will disable these error messages. to a zero will disable these error messages.
If If
.Va optstring
.Fa optstring
has a leading has a leading
.Ql \&: .Ql \&:
then a missing option argument causes a then a missing option argument causes a
@ -198,7 +202,7 @@ this is reasonable but reduces the amount of error checking possible.
.Xr getopt 1 , .Xr getopt 1 ,
.Xr getopt_long 3 , .Xr getopt_long 3 ,
.Xr getsubopt 3 .Xr getsubopt 3
.Sh EXTENSIONS
.Sh STANDARDS
The The
.Va optreset .Va optreset
variable was added to make it possible to call the variable was added to make it possible to call the
@ -223,7 +227,7 @@ This was changed by
to decouple to decouple
.Fn getopt .Fn getopt
from from
.Pa <stdio.h> .
.Aq Pa stdio.h .
.Pp .Pp
A single dash A single dash
.Pq Ql - .Pq Ql -


Loading…
Cancel
Save