From 06cf2034ac0f3291c79f6ac69724ddbcefcda503 Mon Sep 17 00:00:00 2001 From: miod Date: Tue, 23 Dec 2003 20:09:42 +0000 Subject: Use getopt(3) correctly. --- regress/lib/libpthread/switch/switch.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'regress/lib/libpthread/switch/switch.c') 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)) { -- cgit v1.2.3-59-g8ed1b