summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorwiz <wiz@NetBSD.org>2003-09-09 19:31:53 +0000
committerwiz <wiz@NetBSD.org>2003-09-09 19:31:53 +0000
commit185463aee4f810ccadc9b5e4ee3e8ff9de87663b (patch)
tree6c281aebbb933764c683161d7c7912573ee16797 /lib/libc/stdlib
parentf741d2d094593e896a10c133383ecf1ee3f91baa (diff)
Fix typos and declare a missing variable in example. From Quentin Garnier in PR 22733.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/getopt.38
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 96115368a94..7f7a95626d3 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: getopt.3,v 1.26 2003/08/07 16:43:39 agc Exp $
+.\" $NetBSD: getopt.3,v 1.27 2003/09/09 19:31:53 wiz Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -127,7 +127,7 @@ by the option
.Ql --
(double dash) which causes
.Fn getopt
-to signal the end of argument processing and returns \-1.
+to signal the end of argument processing and return \-1.
When all options have been processed (i.e., up to the first non-option
argument),
.Fn getopt
@@ -242,14 +242,14 @@ It is provided for backward compatibility
The following code fragment works in most cases.
.Bd -literal -offset indent
int length;
-char *p;
+char *p,c;
while ((c = getopt(argc, argv, "0123456789")) != -1) {
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
p = argv[optind - 1];
- if (p[0] == '-' \*[Am]\*[Am] p[1] == ch \*[Am]\*[Am] !p[2])
+ if (p[0] == '-' \*[Am]\*[Am] p[1] == c \*[Am]\*[Am] !p[2])
length = atoi(++p);
else
length = atoi(argv[optind] + 1);