summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/getopt.3
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2000-04-20 13:50:04 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2000-04-20 13:50:04 +0000
commitba6b056376adedc82f4ac0f41b5eed2fa3f30c75 (patch)
treee5c095a3d4f9afb3b98cca651e27f12c8880ffbd /lib/libc/stdlib/getopt.3
parent51643f419480d5bdfbed4ef6c16cf20340d8a357 (diff)
Flesh out stdlib function man pages.
Diffstat (limited to 'lib/libc/stdlib/getopt.3')
-rw-r--r--lib/libc/stdlib/getopt.333
1 files changed, 13 insertions, 20 deletions
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 637a81f1f0f..ef132cafc59 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: getopt.3,v 1.12 2000/03/04 22:19:31 aaron Exp $
+.\" $OpenBSD: getopt.3,v 1.13 2000/04/20 13:50:02 aaron Exp $
.\"
.Dd April 19, 1994
.Dt GETOPT 3
@@ -51,27 +51,25 @@ The
.Fn getopt
function incrementally parses a command line argument list
.Fa argv
-and returns the next
-.Em known
-option character.
+and returns the next known option character.
An option character is
-.Em known
+.Dq known
if it has been specified in the string of accepted option characters,
.Fa optstring .
.Pp
The option string
.Fa optstring
-may contain the following elements: individual characters, and
+may contain the following elements: individual characters and
characters followed by a colon to indicate an option argument
is to follow.
For example, an option string
-.Li "\&""x""
+.Qq x
recognizes an option
-.Dq Fl x ,
+.Fl x ,
and an option string
-.Li "\&""x:""
+.Qq Li x:
recognizes an option and argument
-.Dq Fl x Ar argument .
+.Fl x Ar argument .
It does not matter to
.Fn getopt
if a following argument has leading whitespace.
@@ -89,12 +87,10 @@ to
.Fn getopt .
The variable
.Va optopt
-saves the last
-.Em known
-option character returned by
+saves the last known option character returned by
.Fn getopt .
.Pp
-The variable
+The variables
.Va opterr
and
.Va optind
@@ -119,9 +115,7 @@ must be reinitialized.
.Pp
The
.Fn getopt
-function
-returns \-1
-when the argument list is exhausted.
+function returns \-1 when the argument list is exhausted.
The interpretation of options in the argument list may be cancelled
by the option
.Ql --
@@ -157,9 +151,8 @@ then a missing option argument causes a
to be returned in addition to suppressing any error messages.
.Pp
Option arguments are allowed to begin with
-.Dq Li \- ;
-this is reasonable but
-reduces the amount of error checking possible.
+.Ql - ;
+this is reasonable but reduces the amount of error checking possible.
.Sh EXTENSIONS
The
.Va optreset