#include "includes.h"
#include "system/filesys.h"
-#include "popt_common.h"
+#include "lib/cmdline/cmdline.h"
#include "nmbd/nmbd.h"
#include "serverid.h"
#include "messages.h"
.descrip = "Listen on the specified port",
},
POPT_COMMON_SAMBA
+ POPT_COMMON_VERSION
POPT_TABLEEND
};
const struct loadparm_substitution *lp_sub =
*/
umask(0);
- setup_logging(argv[0], DEBUG_DEFAULT_STDOUT);
-
smb_init_locale();
+ ok = samba_cmdline_init(frame,
+ SAMBA_CMDLINE_CONFIG_SERVER,
+ true /* require_smbconf */);
+ if (!ok) {
+ DBG_ERR("Failed to init cmdline parser!\n");
+ TALLOC_FREE(frame);
+ exit(ENOMEM);
+ }
+
global_nmb_port = NMB_PORT;
- pc = poptGetContext("nmbd", argc, argv, long_options, 0);
+ pc = samba_popt_get_context(getprogname(),
+ argc,
+ argv,
+ long_options,
+ 0);
+ if (pc == NULL) {
+ DBG_ERR("Failed to setup popt context!\n");
+ TALLOC_FREE(frame);
+ exit(1);
+ }
+
while ((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_DAEMON:
SAFE_FREE(lfile);
}
- fault_setup();
dump_core_setup("nmbd", lp_logfile(talloc_tos(), lp_sub));
/* POSIX demands that signals are inherited. If the invoking process has
DEBUG(0,("nmbd version %s started.\n", samba_version_string()));
DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
- if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
- DEBUG(0, ("error opening config file '%s'\n", get_dyn_CONFIGFILE()));
- exit(1);
- }
-
reopen_logs();
if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC
msg = messaging_init(NULL, global_event_context());
if (msg == NULL) {
+ DBG_ERR("Failed to init messaging context!\n");
return 1;
}