--- ./miniupnpd.c.orig 2014-04-23 15:41:11.783562093 +0000 +++ ./miniupnpd.c 2014-04-23 15:43:19.672842038 +0000 @@ -797,7 +797,7 @@ { int i; int pid; - int debug_flag = 0; + int debug_flag = 0, foreground_flag = 0; int openlog_option; struct sigaction sa; /*const char * logfilename = 0;*/ @@ -1159,6 +1159,9 @@ case 'd': debug_flag = 1; break; + case 'D': + foreground_flag = 1; + break; case 'w': if(i+1 < argc) presurl = argv[++i]; @@ -1273,7 +1276,7 @@ goto print_usage; } - if(debug_flag) + if(debug_flag || foreground_flag) { pid = getpid(); } @@ -1413,7 +1416,8 @@ "\tNotify interval is in seconds. Default is 30 seconds.\n" "\tDefault pid file is '%s'.\n" "\tDefault config file is '%s'.\n" - "\tWith -d miniupnpd will run as a standard program.\n" + "\tWith -D miniupnpd will run as a standard program.\n" + "\tWith -d miniupnpd will run as a standard program in debug mode.\n" #if defined(USE_PF) || defined(USE_IPF) "\t-L sets packet log in pf and ipf on.\n" #endif