From a4336f357f9e30dffdfad4909b24bd2e82c096a2 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Thu, 20 Apr 2000 13:50:03 +0000 Subject: Flesh out stdlib function man pages. --- src/lib/libc/stdlib/getopt.3 | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/lib/libc/stdlib/getopt.3') diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3 index 637a81f1f0..ef132cafc5 100644 --- a/src/lib/libc/stdlib/getopt.3 +++ b/src/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 -- cgit v1.2.3-55-g6feb