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.319
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/libc/stdlib/getopt.3 b/src/lib/libc/stdlib/getopt.3
index f843881afd..4340ff54fd 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.\" @(#)getopt.3 8.4 (Berkeley) 4/19/94 32.\" $OpenBSD: getopt.3,v 1.6 1998/05/05 19:36:03 deraadt Exp $
33.\" 33.\"
34.Dd April 19, 1994 34.Dd April 19, 1994
35.Dt GETOPT 3 35.Dt GETOPT 3
@@ -137,12 +137,12 @@ returns \-1.
137If the 137If the
138.Fn getopt 138.Fn getopt
139function encounters a character not found in the string 139function encounters a character not found in the string
140.Va optarg 140.Va optstring
141or detects 141or detects
142a missing option argument it writes an error message and returns 142a missing option argument it writes an error message to
143.Ql ? 143.Em stderr
144to the 144and returns
145.Em stderr . 145.Ql ? .
146Setting 146Setting
147.Va opterr 147.Va opterr
148to a zero will disable these error messages. 148to a zero will disable these error messages.
@@ -174,8 +174,8 @@ extern int optind;
174int bflag, ch, fd; 174int bflag, ch, fd;
175 175
176bflag = 0; 176bflag = 0;
177while ((ch = getopt(argc, argv, "bf:")) != -1) 177while ((ch = getopt(argc, argv, "bf:")) != -1) {
178 switch(ch) { 178 switch (ch) {
179 case 'b': 179 case 'b':
180 bflag = 1; 180 bflag = 1;
181 break; 181 break;
@@ -189,6 +189,7 @@ while ((ch = getopt(argc, argv, "bf:")) != -1)
189 case '?': 189 case '?':
190 default: 190 default:
191 usage(); 191 usage();
192 }
192} 193}
193argc -= optind; 194argc -= optind;
194argv += optind; 195argv += optind;
@@ -213,7 +214,7 @@ from
213.Pp 214.Pp
214A single dash 215A single dash
215.Dq Li - 216.Dq Li -
216may be specified as an character in 217may be specified as a character in
217.Fa optstring , 218.Fa optstring ,
218however it should 219however it should
219.Em never 220.Em never