svn commit: r290953 - user/ngie/more-tests2/sbin/ggate/ggated

Garrett Cooper ngie at FreeBSD.org
Mon Nov 16 22:22:19 UTC 2015


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);


More information about the svn-src-user mailing list