diff options
author | Jeremy Allison <jra@samba.org> | 2007-10-19 11:38:36 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-10-19 11:38:36 -0700 |
commit | 9a85533914119fb995fb61555c9f6e0018d4d181 (patch) | |
tree | 61bd1af2845f9fa2eb7632c1173d382131772798 /source3/nmbd | |
parent | 61e482cfdfec09ed01225320ba6a4acd47081f63 (diff) | |
download | samba-9a85533914119fb995fb61555c9f6e0018d4d181.tar.gz samba-9a85533914119fb995fb61555c9f6e0018d4d181.tar.bz2 samba-9a85533914119fb995fb61555c9f6e0018d4d181.zip |
Fix the popt / bool issues. Some places we used BOOL
where we meant int. Fix this. Thanks to metze for
pointing this out.
Jeremy.
(This used to be commit 793a9d24a163cb6cf5a3a0aa5ae30e9f8cf4744a)
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/nmbd.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 510e676e33..69117ee4ea 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -681,23 +681,31 @@ static bool open_sockets(bool isdaemon, int port) /**************************************************************************** ** main program **************************************************************************** */ + int main(int argc, const char *argv[]) { - static int is_daemon; - static int Fork = True; - static int log_stdout; + static bool is_daemon; + static bool opt_interactive; + static bool Fork = true; + static bool no_process_group; + static bool log_stdout; pstring logfile; - static int opt_interactive; poptContext pc; static char *p_lmhosts = dyn_LMHOSTSFILE; - static int no_process_group = False; int opt; + enum { + OPT_DAEMON = 1000, + OPT_INTERACTIVE, + OPT_FORK, + OPT_NO_PROCESS_GROUP, + OPT_LOG_STDOUT + }; struct poptOption long_options[] = { POPT_AUTOHELP - {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon(default)" }, - {"interactive", 'i', POPT_ARG_VAL, &opt_interactive, True, "Run interactive (not a daemon)" }, - {"foreground", 'F', POPT_ARG_VAL, &Fork, False, "Run daemon in foreground (for daemontools & etc)" }, - {"no-process-group", 0, POPT_ARG_VAL, &no_process_group, True, "Don't create a new process group" }, + {"daemon", 'D', POPT_ARG_NONE, NULL, OPT_DAEMON, "Become a daemon(default)" }, + {"interactive", 'i', POPT_ARG_NONE, NULL, OPT_INTERACTIVE, "Run interactive (not a daemon)" }, + {"foreground", 'F', POPT_ARG_NONE, NULL, OPT_FORK, "Run daemon in foreground (for daemontools & etc)" }, + {"no-process-group", 0, POPT_ARG_NONE, NULL, OPT_NO_PROCESS_GROUP, "Don't create a new process group" }, {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" }, {"hosts", 'H', POPT_ARG_STRING, &p_lmhosts, 'H', "Load a netbios hosts file"}, {"port", 'p', POPT_ARG_INT, &global_nmb_port, NMB_PORT, "Listen on the specified port" }, @@ -712,6 +720,21 @@ static bool open_sockets(bool isdaemon, int port) pc = poptGetContext("nmbd", argc, argv, long_options, 0); while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { + case OPT_DAEMON: + is_daemon = true; + break; + case OPT_INTERACTIVE: + opt_interactive = true; + break; + case OPT_FORK: + Fork = false; + break; + case OPT_NO_PROCESS_GROUP: + no_process_group = true; + break; + case OPT_LOG_STDOUT: + log_stdout = true; + break; default: d_fprintf(stderr, "\nInvalid option %s: %s\n\n", poptBadOption(pc, 0), poptStrerror(opt)); |