getopt_long.3 (64f37911f8e5a367c616a2c670859d7593d6f24b) getopt_long.3 (629a7369d77d0ec1ffb36992bad58e4eab1eb882)
1.\" $OpenBSD: getopt_long.3,v 1.10 2004/01/06 23:44:28 fgsch Exp $
2.\" $NetBSD: getopt_long.3,v 1.14 2003/08/07 16:43:40 agc Exp $
3.\"
4.\" Copyright (c) 1988, 1991, 1993
5.\" The Regents of the University of California. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 119 unchanged lines hidden (view full) ---

128.Va has_arg
129field should be one of:
130.Pp
131.Bl -tag -width ".Dv optional_argument" -offset indent -compact
132.It Dv no_argument
133no argument to the option is expect
134.It Dv required_argument
135an argument to the option is required
1.\" $OpenBSD: getopt_long.3,v 1.10 2004/01/06 23:44:28 fgsch Exp $
2.\" $NetBSD: getopt_long.3,v 1.14 2003/08/07 16:43:40 agc Exp $
3.\"
4.\" Copyright (c) 1988, 1991, 1993
5.\" The Regents of the University of California. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions

--- 119 unchanged lines hidden (view full) ---

128.Va has_arg
129field should be one of:
130.Pp
131.Bl -tag -width ".Dv optional_argument" -offset indent -compact
132.It Dv no_argument
133no argument to the option is expect
134.It Dv required_argument
135an argument to the option is required
136.It Li optional_argument
136.It Dv optional_argument
137an argument to the option may be presented.
138.El
139.Pp
140If
141.Va flag
142is not
143.Dv NULL ,
144then the integer pointed to by it will be set to the

--- 40 unchanged lines hidden (view full) ---

185If an option starting with
186.Ql -
187does not match a long option but does match a single-character option,
188the single-character option is returned.
189.Sh RETURN VALUES
190If the
191.Fa flag
192field in
137an argument to the option may be presented.
138.El
139.Pp
140If
141.Va flag
142is not
143.Dv NULL ,
144then the integer pointed to by it will be set to the

--- 40 unchanged lines hidden (view full) ---

185If an option starting with
186.Ql -
187does not match a long option but does match a single-character option,
188the single-character option is returned.
189.Sh RETURN VALUES
190If the
191.Fa flag
192field in
193.Li struct option
193.Vt "struct option"
194is
195.Dv NULL ,
196.Fn getopt_long
197and
198.Fn getopt_long_only
199return the value specified in the
200.Fa val
201field, which is usually just the corresponding short option.

--- 244 unchanged lines hidden (view full) ---

446The aspects normally used by
447the caller (ordering after \-1 is returned, value of
448.Va optind
449relative
450to current positions) are the same, though.
451(We do fewer variable swaps.)
452.El
453.Sh ENVIRONMENT
194is
195.Dv NULL ,
196.Fn getopt_long
197and
198.Fn getopt_long_only
199return the value specified in the
200.Fa val
201field, which is usually just the corresponding short option.

--- 244 unchanged lines hidden (view full) ---

446The aspects normally used by
447the caller (ordering after \-1 is returned, value of
448.Va optind
449relative
450to current positions) are the same, though.
451(We do fewer variable swaps.)
452.El
453.Sh ENVIRONMENT
454.Bl -tag -width POSIXLY_CORRECT
454.Bl -tag -width ".Ev POSIXLY_CORRECT"
455.It Ev POSIXLY_CORRECT
456If set, option processing stops when the first non-option is found and
457a leading
458.Ql -
459or
460.Ql +
461in the
455.It Ev POSIXLY_CORRECT
456If set, option processing stops when the first non-option is found and
457a leading
458.Ql -
459or
460.Ql +
461in the
462.Ar optstring
462.Fa optstring
463is ignored.
464.El
465.Sh SEE ALSO
466.Xr getopt 3
467.Sh HISTORY
468The
469.Fn getopt_long
470and

--- 18 unchanged lines hidden (view full) ---

489.Fn getopt_long
490in
491.Fx 5.0 ,
492.Fn getopt_long_only
493in
494.Fx 5.2 .
495.Sh BUGS
496The
463is ignored.
464.El
465.Sh SEE ALSO
466.Xr getopt 3
467.Sh HISTORY
468The
469.Fn getopt_long
470and

--- 18 unchanged lines hidden (view full) ---

489.Fn getopt_long
490in
491.Fx 5.0 ,
492.Fn getopt_long_only
493in
494.Fx 5.2 .
495.Sh BUGS
496The
497.Ar argv
497.Fa argv
498argument is not really
498argument is not really
499.Dv const
499.Vt const
500as its elements may be permuted (unless
501.Ev POSIXLY_CORRECT
502is set).
503.Pp
504The implementation can completely replace
505.Xr getopt 3 ,
506but right now we are using separate code.
500as its elements may be permuted (unless
501.Ev POSIXLY_CORRECT
502is set).
503.Pp
504The implementation can completely replace
505.Xr getopt 3 ,
506but right now we are using separate code.