mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:utils: Migrate dbwrap_torture to new cmdline option parser
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
6bb6e0c54f
commit
774663094d
@ -21,7 +21,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
#include "system/filesys.h"
|
||||
#include "popt_common.h"
|
||||
#include "lib/cmdline/cmdline.h"
|
||||
#include "dbwrap/dbwrap.h"
|
||||
#include "dbwrap/dbwrap_open.h"
|
||||
#include "messages.h"
|
||||
@ -243,6 +243,7 @@ int main(int argc, const char *argv[])
|
||||
{ "db-name", 'N', POPT_ARG_STRING, &db_name, 0, "name of the test db", "NAME" },
|
||||
{ "no-trans", 'n', POPT_ARG_NONE, &no_trans, 0, "use fetch_lock/record store instead of transactions", NULL },
|
||||
{ "unsafe-writes", 'u', POPT_ARG_NONE, &unsafe_writes, 0, "do not use tdb transactions when writing", NULL },
|
||||
POPT_COMMON_VERSION
|
||||
POPT_TABLEEND
|
||||
};
|
||||
int opt;
|
||||
@ -250,7 +251,7 @@ int main(int argc, const char *argv[])
|
||||
int extra_argc = 0;
|
||||
poptContext pc;
|
||||
int tdb_flags;
|
||||
|
||||
bool ok;
|
||||
int ret = 1;
|
||||
|
||||
mem_ctx = talloc_stackframe();
|
||||
@ -263,10 +264,26 @@ int main(int argc, const char *argv[])
|
||||
|
||||
smb_init_locale();
|
||||
|
||||
setup_logging(argv[0], DEBUG_STDERR);
|
||||
ok = samba_cmdline_init(mem_ctx,
|
||||
SAMBA_CMDLINE_CONFIG_CLIENT,
|
||||
false /* require_smbconf */);
|
||||
if (!ok) {
|
||||
DBG_ERR("Failed to init cmdline parser!\n");
|
||||
TALLOC_FREE(mem_ctx);
|
||||
exit(1);
|
||||
}
|
||||
lp_set_cmdline("log level", "0");
|
||||
|
||||
pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
|
||||
pc = samba_popt_get_context(getprogname(),
|
||||
argc,
|
||||
argv,
|
||||
popt_options,
|
||||
POPT_CONTEXT_KEEP_FIRST);
|
||||
if (pc == NULL) {
|
||||
DBG_ERR("Failed to setup popt context!\n");
|
||||
TALLOC_FREE(mem_ctx);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while ((opt = poptGetNextOpt(pc)) != -1) {
|
||||
switch (opt) {
|
||||
@ -284,8 +301,6 @@ int main(int argc, const char *argv[])
|
||||
while (extra_argv[extra_argc]) extra_argc++;
|
||||
}
|
||||
|
||||
lp_load_global(get_dyn_CONFIGFILE());
|
||||
|
||||
ev_ctx = samba_tevent_context_init(mem_ctx);
|
||||
if (ev_ctx == NULL) {
|
||||
d_fprintf(stderr, "ERROR: could not init event context\n");
|
||||
|
@ -143,7 +143,9 @@ bld.SAMBA3_BINARY('dbwrap_torture',
|
||||
source='dbwrap_torture.c',
|
||||
deps='''
|
||||
talloc
|
||||
popt_samba3''',
|
||||
CMDLINE_S3
|
||||
smbconf
|
||||
''',
|
||||
install=False)
|
||||
|
||||
bld.SAMBA3_BINARY('split_tokens',
|
||||
|
Loading…
Reference in New Issue
Block a user