Browse Source

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

tags/ggatessh-v1.0.0
ngie 9 years ago
parent
commit
401cdeba19
1 changed files with 2 additions and 7 deletions
  1. +2
    -7
      ggated/ggated.c

+ 2
- 7
ggated/ggated.c View File

@@ -949,17 +949,12 @@ main(int argc, char *argv[])
struct sockaddr_in serv; struct sockaddr_in serv;
struct sockaddr from; struct sockaddr from;
socklen_t fromlen; socklen_t fromlen;
int sfd, tmpsfd;
int ch, sfd, tmpsfd;
unsigned port; unsigned port;


bindaddr = htonl(INADDR_ANY); bindaddr = htonl(INADDR_ANY);
port = G_GATE_PORT; 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) { switch (ch) {
case 'a': case 'a':
bindaddr = g_gate_str2ip(optarg); bindaddr = g_gate_str2ip(optarg);


Loading…
Cancel
Save