From d70a9a130b6284238671d8ab671294c3cd329979 Mon Sep 17 00:00:00 2001 From: dcp1990 Date: Thu, 2 Jun 2005 02:55:07 +0000 Subject: [PATCH] Daemonise if so desired --- phoned/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phoned/main.c b/phoned/main.c index 8e5221a..84a7a7e 100644 --- a/phoned/main.c +++ b/phoned/main.c @@ -16,7 +16,7 @@ short difflog = 0; void usage(argv) const char* argv; { - fprintf(stderr, "%s: usage: %s [-h] [-c config] [-l log]\n", argv, argv); + fprintf(stderr, "%s: usage: %s [-hd] [-c config] [-l log]\n", argv, argv); } int main(argc, argv) @@ -25,7 +25,7 @@ int main(argc, argv) { int c; cf.cfile = CONFIGFILE; -#define OPTSTRING "hc:l:" +#define OPTSTRING "dhc:l:" while((c = getopt(argc, argv, OPTSTRING)) != -1) switch(c) { case 'c': @@ -38,6 +38,9 @@ int main(argc, argv) cf.logfile = strdup(optarg); difflog = 1; break; + case 'd': + daemon(0, 0); + break; default: usage(strdup(*argv)); return -2;