From 401cdeba19cc55d68f3dc280dbc3adae7bfb297a Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 16 Nov 2015 22:22:17 +0000 Subject: [PATCH] Use a more common pattern for parsing with getopt(3) --- ggated/ggated.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ggated/ggated.c b/ggated/ggated.c index 4e3fd45..262550e 100644 --- a/ggated/ggated.c +++ b/ggated/ggated.c @@ -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);