summaryrefslogtreecommitdiff
path: root/source4/lib/cmdline
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-28 01:17:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:25 -0500
commit37d53832a4623653f706e77985a79d84bd7c6694 (patch)
tree265e308027d6641bbdb29a4feddbe86ef8b25fd1 /source4/lib/cmdline
parente09226cb35d627affddc08c4a88527184b8ffcf9 (diff)
downloadsamba-37d53832a4623653f706e77985a79d84bd7c6694.tar.gz
samba-37d53832a4623653f706e77985a79d84bd7c6694.tar.bz2
samba-37d53832a4623653f706e77985a79d84bd7c6694.zip
r25398: Parse loadparm context to all lp_*() functions.
(This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238)
Diffstat (limited to 'source4/lib/cmdline')
-rw-r--r--source4/lib/cmdline/popt_common.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index 6e0573e7ef..41eb70094e 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -23,6 +23,7 @@
#include "version.h"
#include "lib/cmdline/popt_common.h"
#include "param/param.h"
+#include "dynconfig.h"
/* Handle command line options:
* -d,--debuglevel
@@ -40,8 +41,6 @@ enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR};
struct cli_credentials *cmdline_credentials = NULL;
-static bool PrintSambaVersionString;
-
static void popt_common_callback(poptContext con,
enum poptCallbackReason reason,
const struct poptOption *opt,
@@ -50,12 +49,12 @@ static void popt_common_callback(poptContext con,
const char *pname;
if (reason == POPT_CALLBACK_REASON_POST) {
- if (PrintSambaVersionString) {
- printf( "Version %s\n", SAMBA_VERSION_STRING );
- exit(0);
+ if (!lp_loaded()) {
+ if (getenv("SMB_CONF_PATH"))
+ lp_load(getenv("SMB_CONF_PATH"));
+ else
+ lp_load(dyn_CONFIGFILE);
}
-
- lp_load();
/* Hook any 'every Samba program must do this, after
* the smb.conf is setup' functions here */
return;
@@ -77,9 +76,6 @@ static void popt_common_callback(poptContext con,
/* and logging */
setup_logging(pname, DEBUG_STDOUT);
- if (getenv("SMB_CONF_PATH")) {
- lp_set_cmdline(global_loadparm, "config file", getenv("SMB_CONF_PATH"));
- }
return;
}
@@ -93,8 +89,8 @@ static void popt_common_callback(poptContext con,
break;
case 'V':
- PrintSambaVersionString = true;
- break;
+ printf("Version %s\n", SAMBA_VERSION_STRING );
+ exit(0);
case 'O':
if (arg) {
@@ -104,7 +100,7 @@ static void popt_common_callback(poptContext con,
case 's':
if (arg) {
- lp_set_cmdline(global_loadparm, "config file", arg);
+ lp_load(arg);
}
break;