summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorJason McIntyre <jmc@cvs.openbsd.org>2003-09-18 09:29:28 +0000
committerJason McIntyre <jmc@cvs.openbsd.org>2003-09-18 09:29:28 +0000
commit0fce946bed01b70893658acc188bd388bffa7d2e (patch)
tree9f9b4cb94113857b9d58e473ce753d4b67cc6ab6 /lib/libc/stdlib
parent559803894fe88d99043faaaf60bb10b3fb24df85 (diff)
typos from wiz@netbsd (including one from a PR from Quentin Garnier);
slight sync with NetBSD page; ok millert@
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/getopt.324
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 9b27b70e65d..50b756bfbb4 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" 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
.Dt GETOPT 3
@@ -47,9 +47,11 @@ The
.Fn getopt
function incrementally parses a command line argument list
.Fa argv
-and returns the next known option character.
+and returns the next
+.Em known
+option character.
An option character is
-.Dq known
+.Em known
if it has been specified in the string of accepted option characters,
.Fa optstring .
.Pp
@@ -113,7 +115,7 @@ by the option
.Ql --
(double dash) which causes
.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
argument),
.Fn getopt
@@ -134,9 +136,9 @@ it returns
If
.Fa optstring
has a leading
-.Sq \:
+.Sq \&:
then a missing option argument causes
-.Sq \:
+.Sq \&:
to be returned instead of
.Sq \&? .
In either case, the variable
@@ -147,6 +149,8 @@ The
function returns \-1 when the argument list is exhausted.
.Sh EXAMPLES
.Bd -literal -compact
+extern char *optarg;
+extern int optind;
int bflag, ch, fd;
bflag = 0;
@@ -174,7 +178,7 @@ argv += optind;
If the
.Fn getopt
function encounters a character not found in the string
-.Va optstring
+.Fa optstring
or detects
a missing option argument it writes an error message to
.Em stderr
@@ -184,7 +188,7 @@ Setting
.Va opterr
to a zero will disable these error messages.
If
-.Va optstring
+.Fa optstring
has a leading
.Ql \&:
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_long 3 ,
.Xr getsubopt 3
-.Sh EXTENSIONS
+.Sh STANDARDS
The
.Va optreset
variable was added to make it possible to call the
@@ -223,7 +227,7 @@ This was changed by
to decouple
.Fn getopt
from
-.Pa <stdio.h> .
+.Aq Pa stdio.h .
.Pp
A single dash
.Pq Ql -