misc:Depends=debconf (>= 0.5) | debconf-2.0
-shlibs:Depends=libc6 (>= 2.3.5-1), libssl0.9.8 (>= 0.9.8a-1), zlib1g (>= 1:1.2.1)
+shlibs:Depends=libc6 (>= 2.3.6-6), libssl0.9.8 (>= 0.9.8b-1), zlib1g (>= 1:1.2.1)
char *ctdlport = DEFAULT_PORT; /**< our Port */
int setup_wizard = 0; /**< should we run the setup wizard? \todo */
char wizard_filename[PATH_MAX];/**< where's the setup wizard? */
+int running_as_daemon = 0; /**< should we deamonize on startup? */
+
/**
* \brief This is a generic function to set up a master socket for listening on
/** Parse command line */
#ifdef HAVE_OPENSSL
- while ((a = getopt(argc, argv, "h:i:p:t:x:cfs")) != EOF)
+ while ((a = getopt(argc, argv, "h:i:p:t:x:dcfs")) != EOF)
#else
- while ((a = getopt(argc, argv, "h:i:p:t:x:cf")) != EOF)
+ while ((a = getopt(argc, argv, "h:i:p:t:x:dcf")) != EOF)
#endif
switch (a) {
case 'h':
home_specified = 1;
home=1;
break;
+ case 'd':
+ running_as_daemon = 1;
+ break;
case 'i':
safestrncpy(ip_addr, optarg, sizeof ip_addr);
break;
fprintf(stderr, "usage: webserver "
"[-i ip_addr] [-p http_port] "
"[-t tracefile] [-c] [-f] "
+ "[-d] "
#ifdef HAVE_OPENSSL
"[-s] "
#endif
if (++optind < argc)
ctdlport = argv[optind];
}
+
+ /* daemonize, if we were asked to */
+ if (running_as_daemon) {
+ start_daemon(0);
+ }
+
/** Tell 'em who's in da house */
lprintf(1, SERVER "\n");
lprintf(1, "Copyright (C) 1996-2006 by the Citadel development team.\n"