summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-10-19 11:38:36 -0700
committerJeremy Allison <jra@samba.org>2007-10-19 11:38:36 -0700
commit9a85533914119fb995fb61555c9f6e0018d4d181 (patch)
tree61bd1af2845f9fa2eb7632c1173d382131772798
parent61e482cfdfec09ed01225320ba6a4acd47081f63 (diff)
downloadsamba-9a85533914119fb995fb61555c9f6e0018d4d181.tar.gz
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)
-rw-r--r--source3/nmbd/nmbd.c41
-rw-r--r--source3/smbd/server.c43
-rw-r--r--source3/utils/log2pcaphex.c14
-rw-r--r--source3/utils/net.c10
-rw-r--r--source3/utils/net.h8
-rw-r--r--source3/utils/nmblookup.c32
-rw-r--r--source3/utils/pdbedit.c28
-rw-r--r--source3/utils/profiles.c2
-rw-r--r--source3/utils/smbcacls.c2
-rw-r--r--source3/utils/smbcquotas.c15
-rw-r--r--source3/utils/smbtree.c2
-rw-r--r--source3/utils/status.c50
-rw-r--r--source3/utils/testparm.c4
-rw-r--r--source3/web/swat.c4
-rw-r--r--source3/winbindd/winbindd.c38
15 files changed, 205 insertions, 88 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 510e676e33a..69117ee4ea6 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));
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 1ae2c71ddd1..e52c2b3fba4 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -882,24 +882,30 @@ extern void build_options(bool screen);
int main(int argc,const char *argv[])
{
/* shall I run as a daemon */
- static int is_daemon = False;
- static int interactive = False;
- static int Fork = True;
- static int no_process_group = False;
- static int log_stdout = False;
+ static bool is_daemon = False;
+ static bool interactive = False;
+ static bool Fork = True;
+ static bool no_process_group = False;
+ static bool log_stdout = False;
static char *ports = NULL;
static char *profile_level = NULL;
int opt;
poptContext pc;
bool print_build_options = False;
-
+ 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, &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" },
- {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" },
+ {"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_NONE, NULL, OPT_LOG_STDOUT, "Log to stdout" },
{"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" },
{"port", 'p', POPT_ARG_STRING, &ports, 0, "Listen on the specified ports"},
{"profiling-level", 'P', POPT_ARG_STRING, &profile_level, 0, "Set profiling level","PROFILE_LEVEL"},
@@ -919,6 +925,21 @@ extern void build_options(bool screen);
pc = poptGetContext("smbd", argc, argv, long_options, 0);
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
+ case OPT_DAEMON:
+ is_daemon = true;
+ break;
+ case OPT_INTERACTIVE:
+ 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;
case 'b':
print_build_options = True;
break;
diff --git a/source3/utils/log2pcaphex.c b/source3/utils/log2pcaphex.c
index 6f07c4f5435..20cc40ca59f 100644
--- a/source3/utils/log2pcaphex.c
+++ b/source3/utils/log2pcaphex.c
@@ -35,8 +35,8 @@
#include <assert.h>
-int quiet = 0;
-int hexformat = 0;
+bool quiet = 0;
+bool hexformat = 0;
#define itoa(a) ((a) < 0xa?'0'+(a):'A' + (a-0xa))
@@ -233,8 +233,8 @@ int main (int argc, char **argv)
int in_packet = 0;
struct poptOption long_options[] = {
POPT_AUTOHELP
- { "quiet", 'q', POPT_ARG_NONE, &quiet, 0, "Be quiet, don't output warnings" },
- { "hex", 'h', POPT_ARG_NONE, &hexformat, 0, "Output format readable by text2pcap" },
+ { "quiet", 'q', POPT_ARG_NONE, NULL, 'q', "Be quiet, don't output warnings" },
+ { "hex", 'h', POPT_ARG_NONE, NULL, 'h', "Output format readable by text2pcap" },
POPT_TABLEEND
};
@@ -245,6 +245,12 @@ int main (int argc, char **argv)
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
+ case 'q':
+ quiet = true;
+ break;
+ case 'h':
+ hexformat = true;
+ break;
}
}
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 6cdc7f86713..068118f476f 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -74,9 +74,9 @@ int opt_flags = -1;
int opt_timeout = 0;
const char *opt_target_workgroup = NULL;
int opt_machine_pass = 0;
-bool opt_localgroup = False;
-bool opt_domaingroup = False;
-static bool do_talloc_report=False;
+int opt_localgroup = False;
+int opt_domaingroup = False;
+static int do_talloc_report=False;
const char *opt_newntname = "";
int opt_rid = 0;
int opt_acls = 0;
@@ -84,9 +84,9 @@ int opt_attrs = 0;
int opt_timestamps = 0;
const char *opt_exclude = NULL;
const char *opt_destination = NULL;
-bool opt_testmode = False;
+int opt_testmode = False;
-bool opt_have_ip = False;
+int opt_have_ip = False;
struct in_addr opt_dest_ip;
extern bool AllowDebugChange;
diff --git a/source3/utils/net.h b/source3/utils/net.h
index d2deb931b8e..177c6d36019 100644
--- a/source3/utils/net.h
+++ b/source3/utils/net.h
@@ -102,8 +102,8 @@ extern const char *opt_user_name;
extern const char *opt_password;
extern bool opt_user_specified;
-extern bool opt_localgroup;
-extern bool opt_domaingroup;
+extern int opt_localgroup;
+extern int opt_domaingroup;
extern const char *opt_newntname;
extern int opt_rid;
extern int opt_acls;
@@ -111,9 +111,9 @@ extern int opt_attrs;
extern int opt_timestamps;
extern const char *opt_exclude;
extern const char *opt_destination;
-extern bool opt_testmode;
+extern int opt_testmode;
-extern bool opt_have_ip;
+extern int opt_have_ip;
extern struct in_addr opt_dest_ip;
extern const char *share_type[];
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 6d17fb79829..1a26e81206e 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -30,7 +30,7 @@ static struct in_addr bcast_addr;
static bool recursion_desired = False;
static bool translate_addresses = False;
static int ServerFD= -1;
-static int RootPort = False;
+static bool RootPort = False;
static bool find_status=False;
/****************************************************************************
@@ -201,14 +201,14 @@ int main(int argc,char *argv[])
struct poptOption long_options[] = {
POPT_AUTOHELP
{ "broadcast", 'B', POPT_ARG_STRING, NULL, 'B', "Specify address to use for broadcasts", "BROADCAST-ADDRESS" },
- { "flags", 'f', POPT_ARG_VAL, &give_flags, True, "List the NMB flags returned" },
+ { "flags", 'f', POPT_ARG_NONE, NULL, 'f', "List the NMB flags returned" },
{ "unicast", 'U', POPT_ARG_STRING, NULL, 'U', "Specify address to use for unicast" },
- { "master-browser", 'M', POPT_ARG_VAL, &find_master, True, "Search for a master browser" },
- { "recursion", 'R', POPT_ARG_VAL, &recursion_desired, True, "Set recursion desired in package" },
- { "status", 'S', POPT_ARG_VAL, &find_status, True, "Lookup node status as well" },
+ { "master-browser", 'M', POPT_ARG_NONE, NULL, 'M', "Search for a master browser" },
+ { "recursion", 'R', POPT_ARG_VAL, NULL, 'R', "Set recursion desired in package" },
+ { "status", 'S', POPT_ARG_VAL, NULL, 'S', "Lookup node status as well" },
{ "translate", 'T', POPT_ARG_NONE, NULL, 'T', "Translate IP addresses into names" },
- { "root-port", 'r', POPT_ARG_VAL, &RootPort, True, "Use root port 137 (Win95 only replies to this)" },
- { "lookup-by-ip", 'A', POPT_ARG_VAL, &lookup_by_ip, True, "Do a node status on <name> as an IP Address" },
+ { "root-port", 'r', POPT_ARG_VAL, NULL, 'r', "Use root port 137 (Win95 only replies to this)" },
+ { "lookup-by-ip", 'A', POPT_ARG_VAL, NULL, 'A', "Do a node status on <name> as an IP Address" },
POPT_COMMON_SAMBA
POPT_COMMON_CONNECTION
{ 0, 0, 0, 0 }
@@ -227,6 +227,24 @@ int main(int argc,char *argv[])
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
+ case 'f':
+ give_flags = true;
+ break;
+ case 'M':
+ find_master = true;
+ break;
+ case 'R':
+ recursion_desired = true;
+ break;
+ case 'S':
+ find_status = true;
+ break;
+ case 'r':
+ RootPort = true;
+ break;
+ case 'A':
+ lookup_by_ip = true;
+ break;
case 'B':
bcast_addr = *interpret_addr2(poptGetOptArg(pc));
got_bcast = True;
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index b87e88e406e..7af417098a9 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -723,13 +723,13 @@ static int delete_machine_entry (struct pdb_methods *in, const char *machinename
int main (int argc, char **argv)
{
- static bool list_users = False;
- static bool verbose = False;
- static bool spstyle = False;
- static bool machine = False;
- static bool add_user = False;
- static bool delete_user = False;
- static bool modify_user = False;
+ static int list_users = False;
+ static int verbose = False;
+ static int spstyle = False;
+ static int machine = False;
+ static int add_user = False;
+ static int delete_user = False;
+ static int modify_user = False;
uint32 setparms, checkparms;
int opt;
static char *full_name = NULL;
@@ -740,10 +740,10 @@ int main (int argc, char **argv)
static char *backend = NULL;
static char *backend_in = NULL;
static char *backend_out = NULL;
- static bool transfer_groups = False;
- static bool transfer_account_policies = False;
- static bool reset_account_policies = False;
- static bool force_initialised_password = False;
+ static int transfer_groups = False;
+ static int transfer_account_policies = False;
+ static int reset_account_policies = False;
+ static int force_initialised_password = False;
static char *logon_script = NULL;
static char *profile_path = NULL;
static char *user_domain = NULL;
@@ -752,10 +752,10 @@ int main (int argc, char **argv)
static char *user_sid = NULL;
static long int account_policy_value = 0;
bool account_policy_value_set = False;
- static bool badpw_reset = False;
- static bool hours_reset = False;
+ static int badpw_reset = False;
+ static int hours_reset = False;
static char *pwd_time_format = NULL;
- static bool pw_from_stdin = False;
+ static int pw_from_stdin = False;
struct pdb_methods *bin, *bout, *bdef;
char *configfile = NULL;
TALLOC_CTX *frame = talloc_stackframe();
diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c
index d6094f8baec..f9b17d3dcc5 100644
--- a/source3/utils/profiles.c
+++ b/source3/utils/profiles.c
@@ -26,7 +26,7 @@
DOM_SID old_sid, new_sid;
int change = 0, new_val = 0;
-bool opt_verbose = False;
+int opt_verbose = False;
/********************************************************************
********************************************************************/
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index affebf38be5..b8b29b44eb6 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -32,7 +32,7 @@ static TALLOC_CTX *ctx;
/* numeric is set when the user wants numeric SIDs and ACEs rather
than going via LSA calls to resolve them */
-static bool numeric = False;
+static int numeric = False;
enum acl_mode {SMB_ACL_SET, SMB_ACL_DELETE, SMB_ACL_MODIFY, SMB_ACL_ADD };
enum chown_mode {REQUEST_NONE, REQUEST_CHOWN, REQUEST_CHGRP};
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 387c2963850..a3d90f823b9 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -413,9 +413,9 @@ SETSTRING:\n\
UQLIM:<username>/<softlimit>/<hardlimit> for user quotas\n\
FSQLIM:<softlimit>/<hardlimit> for filesystem defaults\n\
FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
- { "numeric", 'n', POPT_ARG_NONE, &numeric, True, "Don't resolve sids or limits to names" },
- { "verbose", 'v', POPT_ARG_NONE, &verbose, True, "be verbose" },
- { "test-args", 't', POPT_ARG_NONE, &test_args, True, "Test arguments"},
+ { "numeric", 'n', POPT_ARG_NONE, NULL, 'n', "Don't resolve sids or limits to names" },
+ { "verbose", 'v', POPT_ARG_NONE, NULL, 'v', "be verbose" },
+ { "test-args", 't', POPT_ARG_NONE, NULL, 'r', "Test arguments"},
POPT_COMMON_SAMBA
POPT_COMMON_CREDENTIALS
{ NULL }
@@ -444,6 +444,15 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
+ case 'n':
+ numeric = true;
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case 't':
+ test_args = true;
+ break;
case 'L':
if (todo != 0) {
d_printf("Please specify only one option of <-L|-F|-S|-u>\n");
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index d3c95c024c5..09740393823 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -21,7 +21,7 @@
#include "includes.h"
-static bool use_bcast;
+static int use_bcast;
/* How low can we go? */
diff --git a/source3/utils/status.c b/source3/utils/status.c
index d5e482f6fbc..8bf1de0e617 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -38,12 +38,12 @@ static struct server_id Ucrit_pid[SMB_MAXPIDS]; /* Ugly !!! */ /* added by OH
static int Ucrit_MaxPid=0; /* added by OH */
static unsigned int Ucrit_IsActive = 0; /* added by OH */
-static int verbose, brief;
-static int shares_only = 0; /* Added by RJS */
-static int locks_only = 0; /* Added by RJS */
-static bool processes_only=False;
-static int show_brl;
-static bool numeric_only = False;
+static bool verbose, brief;
+static bool shares_only; /* Added by RJS */
+static bool locks_only; /* Added by RJS */
+static bool processes_only;
+static bool show_brl;
+static bool numeric_only;
const char *username = NULL;
@@ -281,16 +281,16 @@ static int traverse_sessionid(struct db_record *db, void *state)
poptContext pc;
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"processes", 'p', POPT_ARG_NONE, &processes_only, 'p', "Show processes only" },
- {"verbose", 'v', POPT_ARG_NONE, &verbose, 'v', "Be verbose" },
- {"locks", 'L', POPT_ARG_NONE, &locks_only, 'L', "Show locks only" },
- {"shares", 'S', POPT_ARG_NONE, &shares_only, 'S', "Show shares only" },
+ {"processes", 'p', POPT_ARG_NONE, NULL, 'p', "Show processes only" },
+ {"verbose", 'v', POPT_ARG_NONE, NULL, 'v', "Be verbose" },
+ {"locks", 'L', POPT_ARG_NONE, NULL, 'L', "Show locks only" },
+ {"shares", 'S', POPT_ARG_NONE, NULL, 'S', "Show shares only" },
{"user", 'u', POPT_ARG_STRING, &username, 'u', "Switch to user" },
- {"brief", 'b', POPT_ARG_NONE, &brief, 'b', "Be brief" },
+ {"brief", 'b', POPT_ARG_NONE, NULL, 'b', "Be brief" },
{"profile", 'P', POPT_ARG_NONE, NULL, 'P', "Do profiling" },
{"profile-rates", 'R', POPT_ARG_NONE, NULL, 'R', "Show call rates" },
- {"byterange", 'B', POPT_ARG_NONE, &show_brl, 'B', "Include byte range locks"},
- {"numeric", 'n', POPT_ARG_NONE, &numeric_only, 'n', "Numeric uid/gid"},
+ {"byterange", 'B', POPT_ARG_NONE, NULL, 'B', "Include byte range locks"},
+ {"numeric", 'n', POPT_ARG_NONE, NULL, 'n', "Numeric uid/gid"},
POPT_COMMON_SAMBA
POPT_TABLEEND
};
@@ -315,12 +315,34 @@ static int traverse_sessionid(struct db_record *db, void *state)
while ((c = poptGetNextOpt(pc)) != -1) {
switch (c) {
- case 'u':
+ case 'p':
+ processes_only = true;
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case 'L':
+ locks_only = true;
+ break;
+ case 'S':
+ shares_only = true;
+ break;
+ case 'b':
+ brief = true;
+ break;
+ case 'u':
Ucrit_addUid(nametouid(poptGetOptArg(pc)));
break;
case 'P':
case 'R':
profile_only = c;
+ break;
+ case 'B':
+ show_brl = true;
+ break;
+ case 'n':
+ numeric_only = true;
+ break;
}
}
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index dbfecf0a034..30e6b2f502a 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -199,8 +199,8 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
{
const char *config_file = dyn_CONFIGFILE;
int s;
- static bool silent_mode = False;
- static bool show_all_parameters = False;
+ static int silent_mode = False;
+ static int show_all_parameters = False;
int ret = 0;
poptContext pc;
static const char *term_code = "";
diff --git a/source3/web/swat.c b/source3/web/swat.c
index cf90ec0792e..7d74fa9d71f 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -30,8 +30,8 @@
#include "includes.h"
#include "web/swat_proto.h"
-static bool demo_mode = False;
-static bool passwd_only = False;
+static int demo_mode = False;
+static int passwd_only = False;
static bool have_write_access = False;
static bool have_read_access = False;
static int iNumNonAutoPrintServices = 0;
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index d5f24d7aa2f..8449795e136 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -984,18 +984,24 @@ static void process_loop(void)
int main(int argc, char **argv, char **envp)
{
pstring logfile;
- static int is_daemon = False;
- static int Fork = True;
- static int log_stdout = False;
- static int no_process_group = False;
+ static bool is_daemon = False;
+ static bool Fork = True;
+ static bool log_stdout = False;
+ static bool no_process_group = False;
+ enum {
+ OPT_DAEMON = 1000,
+ OPT_FORK,
+ OPT_NO_PROCESS_GROUP,
+ OPT_LOG_STDOUT
+ };
struct poptOption long_options[] = {
POPT_AUTOHELP
- { "stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" },
- { "foreground", 'F', POPT_ARG_VAL, &Fork, False, "Daemon in foreground mode" },
- { "no-process-group", 0, POPT_ARG_VAL, &no_process_group, True, "Don't create a new process group" },
- { "daemon", 'D', POPT_ARG_NONE, NULL, 'D', "Become a daemon (default)" },
+ { "stdout", 'S', POPT_ARG_NONE, NULL, OPT_LOG_STDOUT, "Log to stdout" },
+ { "foreground", 'F', POPT_ARG_NONE, NULL, OPT_FORK, "Daemon in foreground mode" },
+ { "no-process-group", 0, POPT_ARG_NONE, NULL, OPT_NO_PROCESS_GROUP, "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, 'i', "Interactive mode" },
- { "no-caching", 'n', POPT_ARG_VAL, &opt_nocache, True, "Disable caching" },
+ { "no-caching", 'n', POPT_ARG_NONE, NULL, 'n', "Disable caching" },
POPT_COMMON_SAMBA
POPT_TABLEEND
};
@@ -1034,7 +1040,7 @@ int main(int argc, char **argv, char **envp)
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
/* Don't become a daemon */
- case 'D':
+ case OPT_DAEMON:
is_daemon = True;
break;
case 'i':
@@ -1042,6 +1048,18 @@ int main(int argc, char **argv, char **envp)
log_stdout = True;
Fork = False;
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;
+ case 'n':
+ opt_nocache = true;
+ break;
default:
d_fprintf(stderr, "\nInvalid option %s: %s\n\n",
poptBadOption(pc, 0), poptStrerror(opt));