Fix the popt / bool issues. Some places we used BOOL
authorJeremy Allison <jra@samba.org>
Fri, 19 Oct 2007 18:38:36 +0000 (11:38 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 19 Oct 2007 18:38:36 +0000 (11:38 -0700)
where we meant int. Fix this. Thanks to metze for
pointing this out.
Jeremy.
(This used to be commit 793a9d24a163cb6cf5a3a0aa5ae30e9f8cf4744a)

15 files changed:
source3/nmbd/nmbd.c
source3/smbd/server.c
source3/utils/log2pcaphex.c
source3/utils/net.c
source3/utils/net.h
source3/utils/nmblookup.c
source3/utils/pdbedit.c
source3/utils/profiles.c
source3/utils/smbcacls.c
source3/utils/smbcquotas.c
source3/utils/smbtree.c
source3/utils/status.c
source3/utils/testparm.c
source3/web/swat.c
source3/winbindd/winbindd.c

index 510e676e33a03dc0326c531cbe2e5991d6d0c74b..69117ee4ea6946bb19e2f06ab81271490b9dbe0f 100644 (file)
@@ -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));
index 1ae2c71ddd10679cac8d67ffc270e7e9e55c01c5..e52c2b3fba47ab177e28a25e5b6933977b7217af 100644 (file)
@@ -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;
index 6f07c4f5435f2f4e9f47a87796884962dea93127..20cc40ca59fad24dfe4a37965e3b4b7c3446d016 100644 (file)
@@ -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;
                }
        }
 
index 6cdc7f86713ba45518633f11098eea255381392c..068118f476f56a7eef71ef9be4e6a7ef8d4f43bb 100644 (file)
@@ -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;
index d2deb931b8e892849636598c9ea58ed4e24ed2bd..177c6d360198e981a8a538c88677946b4fb8cdf3 100644 (file)
@@ -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[];
index 6d17fb7982930b0c2825b42e707dc5623607c800..1a26e81206e02030f544783ef71a047cfe497b09 100644 (file)
@@ -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;
index b87e88e406ec9f9b8053070c31824aa6bb49a0c1..7af417098a9a4e8f130f23a7e0b8e6bdf171bcf9 100644 (file)
@@ -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();
index d6094f8baec66e11448b32b0a3037f783d7d9fe6..f9b17d3dcc56167d7c71d0a48826294c1e4306ef 100644 (file)
@@ -26,7 +26,7 @@
 
 DOM_SID old_sid, new_sid;
 int change = 0, new_val = 0;
-bool opt_verbose = False;
+int opt_verbose = False;
 
 /********************************************************************
 ********************************************************************/
index affebf38be53a5d1b44f02e7f9f053906d293586..b8b29b44eb67dd51bd548b356ad5071b748e4e2e 100644 (file)
@@ -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};
index 387c2963850e74e018c0436d92264c58586f5963..a3d90f823b919807a8f27cd70f4da766dd323e56 100644 (file)
@@ -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");
index d3c95c024c588f8400ea23511cc4945332e55114..09740393823b16d49260cb91ad73cfa4311ffb6c 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "includes.h"
 
-static bool use_bcast;
+static int use_bcast;
 
 /* How low can we go? */
 
index d5e482f6fbc9b92b363caf296429118676127986..8bf1de0e6170d1d6575a0cfe2f32be2a6fd47901 100644 (file)
@@ -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;
                }
        }
 
index dbfecf0a0342f1a4be65a96167ac9a58bf878120..30e6b2f502a0bbbe0fc4729b407e5c54347637b0 100644 (file)
@@ -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 = "";
index cf90ec0792e36584aa6c5023a380548d31ba636f..7d74fa9d71fe10d680500a443d03aaff14cfc61e 100644 (file)
@@ -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;
index d5f24d7aa2f10bc5759abfd2129b5b234b658172..8449795e1360fe6944661b354f6b190bbbf1a08e 100644 (file)
@@ -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));