|
|
@ -0,0 +1,40 @@ |
|
|
|
--- a/htpdate.c
|
|
|
|
+++ b/htpdate.c
|
|
|
|
@@ -395,6 +395,7 @@ Usage: htpdate [-046abdhlqstxD] [-i pid
|
|
|
|
-b burst mode\n\ |
|
|
|
-d debug mode\n\ |
|
|
|
-D daemon mode\n\ |
|
|
|
+ -f run in foreground\n\
|
|
|
|
-h help\n\ |
|
|
|
-i pid file\n\ |
|
|
|
-l use syslog for output\n\ |
|
|
|
@@ -510,7 +511,7 @@ int main( int argc, char *argv[] ) {
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse the command line switches and arguments */ |
|
|
|
- while ( (param = getopt(argc, argv, "046abdhi:lm:p:qstu:xDM:P:") ) != -1)
|
|
|
|
+ while ( (param = getopt(argc, argv, "046abdhi:lm:p:qstu:xDfM:P:") ) != -1)
|
|
|
|
switch( param ) { |
|
|
|
|
|
|
|
case '0': /* HTTP/1.0 */ |
|
|
|
@@ -593,6 +594,9 @@ int main( int argc, char *argv[] ) {
|
|
|
|
daemonize = 1; |
|
|
|
logmode = 1; |
|
|
|
break; |
|
|
|
+ case 'f': /* run in foreground */
|
|
|
|
+ daemonize = 2;
|
|
|
|
+ break;
|
|
|
|
case 'M': /* maximum poll interval */ |
|
|
|
if ( ( maxsleep = atoi(optarg) ) <= 0 ) { |
|
|
|
fputs( "Invalid sleep time\n", stderr ); |
|
|
|
@@ -631,7 +635,9 @@ int main( int argc, char *argv[] ) {
|
|
|
|
|
|
|
|
/* Run as a daemonize when -D is set */ |
|
|
|
if ( daemonize ) { |
|
|
|
- runasdaemon( pidfile );
|
|
|
|
+ if ( daemonize == 1 ) {
|
|
|
|
+ runasdaemon( pidfile );
|
|
|
|
+ }
|
|
|
|
/* Query only mode doesn't exist in daemon mode */ |
|
|
|
if ( !setmode ) |
|
|
|
setmode = 1; |