Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Nov 2015 22:22:17 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r290953 - user/ngie/more-tests2/sbin/ggate/ggated
Message-ID:  <201511162222.tAGMMH3Q083185@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Nov 16 22:22:17 2015
New Revision: 290953
URL: https://svnweb.freebsd.org/changeset/base/290953

Log:
  Use a more common pattern for parsing with getopt(3)

Modified:
  user/ngie/more-tests2/sbin/ggate/ggated/ggated.c

Modified: user/ngie/more-tests2/sbin/ggate/ggated/ggated.c
==============================================================================
--- user/ngie/more-tests2/sbin/ggate/ggated/ggated.c	Mon Nov 16 22:21:10 2015	(r290952)
+++ user/ngie/more-tests2/sbin/ggate/ggated/ggated.c	Mon Nov 16 22:22:17 2015	(r290953)
@@ -949,17 +949,12 @@ main(int argc, char *argv[])
 	struct sockaddr_in serv;
 	struct sockaddr from;
 	socklen_t fromlen;
-	int sfd, tmpsfd;
+	int ch, sfd, tmpsfd;
 	unsigned port;
 
 	bindaddr = htonl(INADDR_ANY);
 	port = G_GATE_PORT;
-	for (;;) {
-		int ch;
-
-		ch = getopt(argc, argv, "a:hnp:R:S:v");
-		if (ch == -1)
-			break;
+	while ((ch = getopt(argc, argv, "a:hnp:R:S:v")) != -1) {
 		switch (ch) {
 		case 'a':
 			bindaddr = g_gate_str2ip(optarg);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511162222.tAGMMH3Q083185>