howto get CONFIGFILE in 3-2-test
Michael Adam
ma at sernet.de
Sat Sep 20 12:11:38 GMT 2008
Hi,
NZzi wrote:
> i know we define "CONFIGFIRE" macro in Makefile
> throug "-DCONFIGFILE".
Right, this effectively defines the default config
file location in the macro CONFIGFILE.
> in 3.0.26, we can get default smb.conf location
> through:
>
> pstring dyn_CONFIGFILE = CONFIGFILE;
>
> in 3.2, we use "DEFINE_DYN_CONFIG_PARAM(CONFIGFILE)",
> and use get_dyn_CONFIGFILE() to get default smb.conf
> location, but i can not find where set the
> "dyn_CONFIGFILE" variable, where call set_dyn_CONFIGFILE.
Since the dyn_CONFIGFILE variable is no longer a static
string but an allocated (char *), one can not simply
assign the value as in 3.0. You have to look at
the definition of the macro DEFINE_DYN_CONFIG_PARAM
to see where the default location comes from.
DEFINE_DYN_CONFIG_PARAM(CONFIGFILE) expands to this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static char *dyn_CONFIGFILE;
const char *get_dyn_CONFIGFILE(void)
{
if (dyn_CONFIGFILE == NULL) {
return CONFIGFILE;
}
return dyn_CONFIGFILE;
}
const char *set_dyn_CONFIGFILE(const char *newpath)
{
if (dyn_##name) {
SAFE_FREE(dyn_##name);
}
dyn_##name = SMB_STRDUP(newpath);
return dyn_##name;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I.e., when set_dyn_CONFIGFILE() has not been
called yet, get_dyn_CONFIGFILE boils down to
"return CONFIGFILE;". That is, the constant
defined by the Makefile is returned.
Cheers, Michael
--
Michael Adam <ma at sernet.de> <obnox at samba.org>
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.SerNet.DE, mailto: Info @ SerNet.DE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 206 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20080920/8aadfee4/attachment.bin
More information about the samba-technical
mailing list