Cleanup. Boldfaced dashes didn't print at all, also corrected a few
other mdoc(5) usage errors. Pointed out by: kuku@physik.rwth-aachen.de (Chris Kukulies)
This commit is contained in:
parent
334dac624a
commit
0b6471c9a2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19111
@ -5,12 +5,12 @@
|
|||||||
.Nm getopt
|
.Nm getopt
|
||||||
.Nd parse command options
|
.Nd parse command options
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm set \-\- \`getopt optstring $*\`
|
.Nm set \-\- \`getopt Ar optstring $*\`
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Getopt
|
.Nm Getopt
|
||||||
is used to break up options in command lines for easy parsing by
|
is used to break up options in command lines for easy parsing by
|
||||||
shell procedures, and to check for legal options.
|
shell procedures, and to check for legal options.
|
||||||
.Op Optstring
|
.Ar Optstring
|
||||||
is a string of recognized option letters (see
|
is a string of recognized option letters (see
|
||||||
.Xr getopt 3
|
.Xr getopt 3
|
||||||
);
|
);
|
||||||
@ -18,27 +18,27 @@ if a letter is followed by a colon, the option
|
|||||||
is expected to have an argument which may or may not be
|
is expected to have an argument which may or may not be
|
||||||
separated from it by white space.
|
separated from it by white space.
|
||||||
The special option
|
The special option
|
||||||
.B \-\-
|
.Ql \-\-
|
||||||
is used to delimit the end of the options.
|
is used to delimit the end of the options.
|
||||||
.Nm Getopt
|
.Nm Getopt
|
||||||
will place
|
will place
|
||||||
.B \-\-
|
.Ql \-\-
|
||||||
in the arguments at the end of the options,
|
in the arguments at the end of the options,
|
||||||
or recognize it if used explicitly.
|
or recognize it if used explicitly.
|
||||||
The shell arguments
|
The shell arguments
|
||||||
(\fB$1 $2\fR ...) are reset so that each option is
|
(\fB$1 $2\fR ...) are reset so that each option is
|
||||||
preceded by a
|
preceded by a
|
||||||
.B \-
|
.Ql \-
|
||||||
and in its own shell argument;
|
and in its own shell argument;
|
||||||
each option argument is also in its own shell argument.
|
each option argument is also in its own shell argument.
|
||||||
.Sh EXAMPLE
|
.Sh EXAMPLE
|
||||||
The following code fragment shows how one might process the arguments
|
The following code fragment shows how one might process the arguments
|
||||||
for a command that can take the options
|
for a command that can take the options
|
||||||
.Op a
|
.Fl a
|
||||||
and
|
and
|
||||||
.Op b ,
|
.Fl b ,
|
||||||
and the option
|
and the option
|
||||||
.Op o ,
|
.Fl o ,
|
||||||
which requires an argument.
|
which requires an argument.
|
||||||
.Pp
|
.Pp
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
@ -77,7 +77,7 @@ cmd \-a \-oarg \-\- file file
|
|||||||
.Nm Getopt
|
.Nm Getopt
|
||||||
prints an error message on the standard error output when it
|
prints an error message on the standard error output when it
|
||||||
encounters an option letter not included in
|
encounters an option letter not included in
|
||||||
.Op optstring .
|
.Ar optstring .
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
Written by Henry Spencer, working from a Bell Labs manual page.
|
Written by Henry Spencer, working from a Bell Labs manual page.
|
||||||
Behavior believed identical to the Bell version.
|
Behavior believed identical to the Bell version.
|
||||||
|
Loading…
Reference in New Issue
Block a user