summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/stdlib/getopt.3')
-rw-r--r--src/lib/libc/stdlib/getopt.323
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3
index 57d2c3668b..3c8779d788 100644
--- a/src/lib/libc/stdlib/getopt.3
+++ b/src/lib/libc/stdlib/getopt.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: getopt.3,v 1.8 1999/05/27 13:09:09 aaron Exp $ 32.\" $OpenBSD: getopt.3,v 1.9 1999/06/29 18:36:20 aaron Exp $
33.\" 33.\"
34.Dd April 19, 1994 34.Dd April 19, 1994
35.Dt GETOPT 3 35.Dt GETOPT 3
@@ -132,22 +132,25 @@ When all options have been processed (i.e., up to the first non-option
132argument), 132argument),
133.Fn getopt 133.Fn getopt
134returns \-1. 134returns \-1.
135.Sh SEE ALSO
136.Xr getopt 1 ,
137.Xr getsubopt 3
135.Sh DIAGNOSTICS 138.Sh DIAGNOSTICS
136If the 139If the
137.Fn getopt 140.Fn getopt
138function encounters a character not found in the string 141function encounters a character not found in the string
139.Va optstring 142.Va optstring
140or detects 143or detects
141a missing option argument it writes an error message to 144a missing option argument it writes an error message to
142.Em stderr 145.Em stderr
143and returns 146and returns
144.Ql ? . 147.Ql ? .
145Setting 148Setting
146.Va opterr 149.Va opterr
147to a zero will disable these error messages. 150to a zero will disable these error messages.
148If 151If
149.Va optstring 152.Va optstring
150has a leading 153has a leading
151.Ql \&: 154.Ql \&:
152then a missing option argument causes a 155then a missing option argument causes a
153.Ql \&: 156.Ql \&:
@@ -202,17 +205,17 @@ function appeared
202The 205The
203.Fn getopt 206.Fn getopt
204function was once specified to return 207function was once specified to return
205.Dv EOF 208.Dv EOF
206instead of \-1. 209instead of \-1.
207This was changed by 210This was changed by
208.St -p1003.2-92 211.St -p1003.2-92
209to decouple 212to decouple
210.Fn getopt 213.Fn getopt
211from 214from
212.Pa <stdio.h> . 215.Pa <stdio.h> .
213.Pp 216.Pp
214A single dash 217A single dash
215.Dq Li - 218.Pq Ql -
216may be specified as a character in 219may be specified as a character in
217.Fa optstring , 220.Fa optstring ,
218however it should 221however it should
@@ -221,7 +224,7 @@ have an argument associated with it.
221This allows 224This allows
222.Fn getopt 225.Fn getopt
223to be used with programs that expect 226to be used with programs that expect
224.Dq Li - 227.Ql -
225as an option flag. 228as an option flag.
226This practice is wrong, and should not be used in any current development. 229This practice is wrong, and should not be used in any current development.
227It is provided for backward compatibility 230It is provided for backward compatibility