summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/getopt_long.3
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-04 21:42:23 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-04 21:42:23 +0000
commit0e6ab77083b85fdf4bc3df24cf7d68979a493721 (patch)
tree5c0d203e83aed9b1e433bba77a594296f502d1fe /lib/libc/stdlib/getopt_long.3
parent32d13e2c6a593618e1481faf09015aa86db2009e (diff)
Add "RETURN VALUES" sections
Diffstat (limited to 'lib/libc/stdlib/getopt_long.3')
-rw-r--r--lib/libc/stdlib/getopt_long.329
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3
index d55f4ead533..cfbe255e6c1 100644
--- a/lib/libc/stdlib/getopt_long.3
+++ b/lib/libc/stdlib/getopt_long.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getopt_long.3,v 1.1 2002/12/03 20:24:30 millert Exp $
+.\" $OpenBSD: getopt_long.3,v 1.2 2002/12/04 21:42:22 millert Exp $
.\" $NetBSD: getopt_long.3,v 1.11 2002/10/02 10:54:19 wiz Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
@@ -163,6 +163,33 @@ If an option starting with
.Sq -
does not match a long option but does match a single-character option,
the single-character option is returned.
+.Sh RETURN VALUES
+If the
+.Fa flag
+field in
+.Li struct option
+is
+.Dv NULL ,
+.Fn getopt_long
+and
+.Fn getopt_long_only
+return the value specified in the
+.Fa val
+field, which is usually just the corresponding short option.
+If
+.Fa flag
+is not
+.Dv NULL ,
+these functions return 0 and store
+.Fa val
+in the location pointed to by
+.Fa flag .
+These functions return
+.Sq \:
+if there was a missing option argument,
+.Sq ?
+if the user specified an unknown or ambiguous option, and
+\-1 when the argument list has been exhausted.
.Sh EXAMPLES
.Bd -literal -compact
int bflag, ch, fd;