Skip to content

Commit

Permalink
daemonize on non-debugging mode. need improvements on logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Sep 12, 1999
1 parent cd9b646 commit 0f04385
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions kame/kame/dhcp6/dhcp6s.c
Expand Up @@ -61,7 +61,6 @@ struct servtab {
struct in6_addr serv;
};

int dump = 0;
int debug = 0;
#define dprintf(x) { if (debug) fprintf x; }
char *device = NULL;
Expand Down Expand Up @@ -91,14 +90,11 @@ main(argc, argv)
struct in6_addr a;

srandom(time(NULL) & getpid());
while ((ch = getopt(argc, argv, "dDn:")) != EOF) {
while ((ch = getopt(argc, argv, "dn:")) != EOF) {
switch (ch) {
case 'd':
debug++;
break;
case 'D':
dump++;
break;
case 'n':
if (inet_pton(AF_INET6, optarg, &a, sizeof(a)) != 1) {
errx(1, "invalid DNS server %s", optarg);
Expand All @@ -120,14 +116,17 @@ main(argc, argv)
}
device = argv[0];

if (!debug)
daemon(0, 0);

mainloop();
exit(0);
}

static void
usage()
{
fprintf(stderr, "usage: dhcp6s [-dD] [-n serv] intface\n");
fprintf(stderr, "usage: dhcp6s [-d] [-n serv] intface\n");
exit(0);
}

Expand Down

0 comments on commit 0f04385

Please sign in to comment.