param: use a single command line set_option in the code
authorGarming Sam <garming@catalyst.net.nz>
Thu, 20 Feb 2014 23:54:29 +0000 (12:54 +1300)
committerJeremy Allison <jra@samba.org>
Wed, 7 May 2014 17:49:16 +0000 (19:49 +0200)
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/popt_common.c

index 25558091c7d9cce0f56cc579fdfa224f40ebc745..be13004e6ea30c1c1849c64e13024b1e391e9163 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "popt_common.h"
+#include "lib/param/param.h"
 
 /* Handle command line options:
  *             -d,--debuglevel 
@@ -99,12 +100,22 @@ static void popt_common_callback(poptContext con,
 
        switch(opt->val) {
        case OPT_OPTION:
-               if (!lp_set_option(arg)) {
+       {
+               struct loadparm_context *lp_ctx;
+
+               lp_ctx = loadparm_init_s3(talloc_tos(), loadparm_s3_helpers());
+               if (lp_ctx == NULL) {
+                       fprintf(stderr, "loadparm_init_s3() failed!\n");
+                       exit(1);
+               }
+
+               if (!lpcfg_set_option(lp_ctx, arg)) {
                        fprintf(stderr, "Error setting option '%s'\n", arg);
                        exit(1);
                }
+               TALLOC_FREE(lp_ctx);
                break;
-
+       }
        case 'd':
                if (arg) {
                        lp_set_cmdline("log level", arg);