1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s3:utils: Migrate tevent_glib_tracker to new cmdline option parser

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu May 20 03:49:30 UTC 2021 on sn-devel-184
This commit is contained in:
Andreas Schneider 2021-01-12 12:58:24 +01:00 committed by Andrew Bartlett
parent de159c40c5
commit 09fed102c5
2 changed files with 18 additions and 8 deletions

View File

@ -21,7 +21,7 @@
#include "includes.h"
#include "lib/util/debug.h"
#include "popt_common.h"
#include "lib/cmdline/cmdline.h"
#include "param.h"
/*
* glib uses TRUE and FALSE which was redefined by "includes.h" to be
@ -205,6 +205,7 @@ int main(int argc, const char **argv)
struct test_state *state = NULL;
int c;
poptContext pc;
bool ok;
struct poptOption long_options[] = {
POPT_AUTOHELP
{
@ -222,6 +223,7 @@ int main(int argc, const char **argv)
.descrip = "Use glib loop",
},
POPT_COMMON_SAMBA
POPT_COMMON_VERSION
POPT_TABLEEND
};
@ -237,17 +239,25 @@ int main(int argc, const char **argv)
state->loop_type = TEVENT_LOOP;
setup_logging(argv[0], DEBUG_STDERR);
smb_init_locale();
if (!lp_load_client(get_dyn_CONFIGFILE())) {
fprintf(stderr, "ERROR: Can't load %s\n",
get_dyn_CONFIGFILE());
ok = samba_cmdline_init(mem_ctx,
SAMBA_CMDLINE_CONFIG_CLIENT,
true /* require_smbconf */);
if (!ok) {
TALLOC_FREE(mem_ctx);
exit(1);
}
pc = poptGetContext(NULL, 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) {
TALLOC_FREE(mem_ctx);
exit(1);
}
while ((c = poptGetNextOpt(pc)) != -1) {
switch (c) {

View File

@ -1404,7 +1404,7 @@ bld.SAMBA3_BINARY('tevent_glib_tracker',
deps='''
talloc
libsmb
popt_samba3
CMDLINE_S3
tevent-glib-glue ''' + bld.env['libtracker'],
enabled=bld.CONFIG_SET('HAVE_TRACKER') and bld.CONFIG_SET('WITH_TEVENT_GLIB_GLUE'),
install=False)