Daemonise if so desired

This commit is contained in:
dcp1990 2005-06-02 02:55:07 +00:00
parent c0883294ef
commit d70a9a130b

View File

@ -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;