diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-12-23 20:09:43 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-12-23 20:09:43 +0000 |
commit | 4301a359b058624b3d8e28e4685f43b043feb424 (patch) | |
tree | 997738ab047fbf4434f869b5c70bb70918db508c | |
parent | f6d10452a089a45e9bd0f36e9a34e9447e5b37c9 (diff) |
Use getopt(3) correctly.
-rw-r--r-- | regress/lib/libpthread/switch/switch.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/regress/lib/libpthread/switch/switch.c b/regress/lib/libpthread/switch/switch.c index f90e9bdca8a..5352bde20ca 100644 --- a/regress/lib/libpthread/switch/switch.c +++ b/regress/lib/libpthread/switch/switch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switch.c,v 1.4 2003/07/31 21:48:07 deraadt Exp $ */ +/* $OpenBSD: switch.c,v 1.5 2003/12/23 20:09:42 miod Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -86,20 +86,16 @@ int main(int argc, char *argv[]) { pthread_t thread; - int count = 4; - int eof = 0; + int ch, count = 4; long i; /* Getopt variables. */ extern int optind, opterr; extern char *optarg; - while (!eof) - switch (getopt (argc, argv, "c:d?")) + while ((ch = getopt(argc, argv, "c:?")) != -1) + switch (ch) { - case EOF: - eof = 1; - break; case 'c': count = atoi(optarg); if ((count > 26) || (count < 2)) { |