summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Peel <jsyn@cvs.openbsd.org>2003-04-10 17:05:09 +0000
committerJason Peel <jsyn@cvs.openbsd.org>2003-04-10 17:05:09 +0000
commit202ed6f090a666f0ce6e987b1c3b757f74e80d52 (patch)
tree7f09772a8652096ead9ebc88e604912b69bff76f
parent28bcd4d480a24c5af3cccb4710790437a6b06ed7 (diff)
make the second example valid; ok millert@
-rw-r--r--lib/libc/stdlib/getopt.37
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 7173b62c5c5..e16a11dfeea 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/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.20 2002/12/08 18:12:50 millert Exp $
+.\" $OpenBSD: getopt.3,v 1.21 2003/04/10 17:05:08 jsyn Exp $
.\"
.Dd December 8, 2002
.Dt GETOPT 3
@@ -270,11 +270,12 @@ It is provided for backward compatibility
.Em only .
The following code fragment works in most cases.
.Bd -literal -offset indent
+int ch;
long length;
char *p;
-while ((c = getopt(argc, argv, "0123456789")) != -1) {
- switch (c) {
+while ((ch = getopt(argc, argv, "0123456789")) != -1) {
+ switch (ch) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
p = argv[optind - 1];