]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: Migrate smbconftort to new cmdline option parser
authorAndreas Schneider <asn@samba.org>
Tue, 12 Jan 2021 10:59:58 +0000 (11:59 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 May 2021 02:58:36 +0000 (02:58 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/lib/smbconf/testsuite.c
source3/wscript_build

index 0053f9f042d537378b594d833bbdb82b489d8370..fa97a52132a35aee9921880b3e394e22513cf111 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #include "includes.h"
-#include "popt_common.h"
+#include "lib/cmdline/cmdline.h"
 #include "lib/smbconf/smbconf.h"
 #include "lib/smbconf/smbconf_init.h"
 #include "lib/smbconf/smbconf_reg.h"
@@ -293,26 +293,34 @@ int main(int argc, const char **argv)
 
        struct poptOption long_options[] = {
                POPT_COMMON_SAMBA
+               POPT_COMMON_VERSION
                POPT_TABLEEND
        };
 
        smb_init_locale();
-       setup_logging(argv[0], DEBUG_STDERR);
+
+       ret = samba_cmdline_init(mem_ctx,
+                                SAMBA_CMDLINE_CONFIG_CLIENT,
+                                true /* require_smbconf */);
+       if (!ret) {
+               goto done;
+       }
 
        /* parse options */
-       pc = poptGetContext("smbconftort", argc, (const char **)argv,
-                           long_options, 0);
+       pc = samba_popt_get_context(getprogname(),
+                                   argc,
+                                   (const char **)argv,
+                                   long_options,
+                                   0);
+       if (pc == NULL) {
+               ret = false;
+               goto done;
+       }
 
        while(poptGetNextOpt(pc) != -1) { }
 
        poptFreeContext(pc);
 
-       ret = lp_load_global(get_dyn_CONFIGFILE());
-       if (!ret) {
-               printf("failure: error loading the configuration\n");
-               goto done;
-       }
-
        ret = torture_smbconf();
 
 done:
index e756c407f94b1e05924d5680ff5c6c14ff59c67e..8ef119100498af5b6f7ab8828d5d0689239cb8b1 100644 (file)
@@ -1250,7 +1250,7 @@ bld.SAMBA3_BINARY('smbconftort',
                  deps='''
                       talloc
                       smbconf
-                      popt_samba3
+                      CMDLINE_S3
                       ''',
                  for_selftest=True)