From: fred_nerk Date: Mon, 24 May 2004 04:42:50 +0000 (+0000) Subject: Add -d detach option X-Git-Tag: release_2_0_1~19 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/67fb382676922a55ea4e9b3bff5f9a368c8765e7?hp=7285c3e91c3bbd77389382efe89355ad12afa47f Add -d detach option --- diff --git a/l2tpns.c b/l2tpns.c index 8fc2167..7b8822d 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -2254,10 +2254,15 @@ int main(int argc, char *argv[]) time(&basetime); // start clock // scan args - while ((o = getopt(argc, argv, "vc:h:a:")) >= 0) + while ((o = getopt(argc, argv, "vc:h:a:d")) >= 0) { switch (o) { + case 'd': + // Double fork to detach from terminal + if (fork()) exit(0); + if (fork()) exit(0); + break; case 'v': config->debug++; break; @@ -2266,7 +2271,7 @@ int main(int argc, char *argv[]) break; case '?': default: - printf("Args are:\n\t-c \tConfig file\n\t-h \tForce hostname\n\t-a
\tUse specific address\n\t-v\t\tDebug\n"); + printf("Args are:\n\t-d\tDetach from terminal\n\t-c \tConfig file\n\t-h \tForce hostname\n\t-a
\tUse specific address\n\t-v\t\tDebug\n"); return (0); break; } @@ -2283,7 +2288,7 @@ int main(int argc, char *argv[]) initdata(); init_cli(); read_config_file(); - log(0, 0, 0, 0, "$Id: l2tpns.c,v 1.6 2004/05/24 04:20:28 fred_nerk Exp $\n(c) Copyright 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced\n"); + log(0, 0, 0, 0, "$Id: l2tpns.c,v 1.7 2004/05/24 04:42:50 fred_nerk Exp $\n(c) Copyright 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced\n"); { struct rlimit rlim; rlim.rlim_cur = RLIM_INFINITY;