diff options
author | Simon Rettberg | 2014-05-27 01:27:10 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-05-27 01:27:10 +0200 |
commit | 6086de1746be753ac2b720fd7eca3e7da31ad2cc (patch) | |
tree | f0f982347e7caa36004da35b3abcee7f53c18219 | |
parent | Daemonize, ignore home if empty (diff) | |
download | ldadp-6086de1746be753ac2b720fd7eca3e7da31ad2cc.tar.gz ldadp-6086de1746be753ac2b720fd7eca3e7da31ad2cc.tar.xz ldadp-6086de1746be753ac2b720fd7eca3e7da31ad2cc.zip |
daemon optional
-rw-r--r-- | ldadp.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -18,11 +18,17 @@ static void loadConfig(char *file); int main(int argc, char **argv) { + BOOL isdaemon = TRUE; if (argc < 2) { printf("Nö\n"); exit(1); } signal(SIGPIPE, SIG_IGN); + if (strcmp(argv[1], "-n") == 0 && argc > 2) { + isdaemon = FALSE; + argv++; + argc--; + } loadConfig(argv[1]); proxy_init(); char listen_addr[4] = {0, 0, 0, 0}; @@ -40,7 +46,7 @@ int main(int argc, char **argv) // Init AD uplinks server_initServers(); // Daeaeaemon - if (daemon(1, 0) == -1) bail("daemon() failed."); + if (isdaemon && daemon(1, 0) == -1) bail("daemon() failed."); // Do the mainloop for (;;) { if (ePoll_wait(-1) == -1) bail("ePoll wait failed."); |