*/
#include "includes.h"
-#include "popt_common.h"
+#include "lib/cmdline/cmdline.h"
#include "libsmb/nmblib.h"
#include "libsmb/namequery.h"
#include "lib/util/string_wrappers.h"
poptContext pc = NULL;
TALLOC_CTX *frame = talloc_stackframe();
int rc = 0;
+ bool ok;
struct poptOption long_options[] = {
POPT_AUTOHELP
},
POPT_COMMON_SAMBA
POPT_COMMON_CONNECTION
+ POPT_COMMON_VERSION
POPT_TABLEEND
};
smb_init_locale();
- setup_logging(argv[0], DEBUG_STDOUT);
+ 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);
+ }
- pc = poptGetContext("nmblookup", 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, "<NODE> ...");
goto out;
}
- if (!lp_load_global(get_dyn_CONFIGFILE())) {
- fprintf(stderr, "Can't load %s - run testparm to debug it\n",
- get_dyn_CONFIGFILE());
- }
-
- load_interfaces();
if (!open_sockets()) {
rc = 1;
goto out;