From 7d6608d1f9194c06de2db7e89b049a4963982aeb Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 12 Jan 2021 15:45:21 +0100 Subject: [PATCH] s3:utils: Migrate profiles to new cmdline option parser Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- source3/utils/profiles.c | 26 ++++++++++++++++++++------ source3/utils/wscript_build | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c index 8c7bd2cb0a4..96b8c9dd82e 100644 --- a/source3/utils/profiles.c +++ b/source3/utils/profiles.c @@ -21,7 +21,7 @@ #include "includes.h" #include "system/filesys.h" -#include "popt_common.h" +#include "lib/cmdline/cmdline.h" #include "registry/reg_objects.h" #include "registry/regfio.h" #include "../libcli/security/security.h" @@ -248,15 +248,29 @@ int main( int argc, const char *argv[] ) POPT_TABLEEND }; poptContext pc; + bool ok; smb_init_locale(); - /* setup logging options */ + ok = samba_cmdline_init(frame, + SAMBA_CMDLINE_CONFIG_CLIENT, + false /* require_smbconf */); + if (!ok) { + DBG_ERR("Failed to init cmdline parser!\n"); + TALLOC_FREE(frame); + exit(1); + } - setup_logging( "profiles", DEBUG_STDERR); - - pc = poptGetContext("profiles", argc, argv, long_options, - POPT_CONTEXT_KEEP_FIRST); + pc = samba_popt_get_context(getprogname(), + argc, + argv, + long_options, + POPT_CONTEXT_KEEP_FIRST); + if (pc == NULL) { + DBG_ERR("Failed to setup popt context!\n"); + TALLOC_FREE(frame); + exit(1); + } poptSetOtherOptionHelp(pc, ""); diff --git a/source3/utils/wscript_build b/source3/utils/wscript_build index bcc2261d82c..c28fd862b3a 100644 --- a/source3/utils/wscript_build +++ b/source3/utils/wscript_build @@ -11,7 +11,7 @@ bld.SAMBA3_BINARY('profiles', source='profiles.c', deps=''' talloc - popt_samba3 + CMDLINE_S3 smbconf REGFIO''')