summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeiko Schlittermann <hs+exim@schlittermann.de>2014-11-29 19:39:58 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2014-11-29 19:41:23 +0000
commitac6652c8a0ac69fc0f46d7f8535aa537cd609c94 (patch)
treeaa377b405f389d8f37d49fd9dbd4e109344c60de /src
parent734076a52c94c290826224e524f49be07d4476e1 (diff)
New variable $config_dir, $config_file. Bug 1553
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c2
-rw-r--r--src/src/globals.c1
-rw-r--r--src/src/globals.h1
-rw-r--r--src/src/readconf.c5
4 files changed, 9 insertions, 0 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index b7df95a18..f61d682b8 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -446,6 +446,8 @@ static var_entry var_table[] = {
{ "caller_uid", vtype_uid, &real_uid },
{ "compile_date", vtype_stringptr, &version_date },
{ "compile_number", vtype_stringptr, &version_cnumber },
+ { "config_dir", vtype_stringptr, &config_main_directory },
+ { "config_file", vtype_stringptr, &config_main_filename },
{ "csa_status", vtype_stringptr, &csa_status },
#ifdef EXPERIMENTAL_DCC
{ "dcc_header", vtype_stringptr, &dcc_header },
diff --git a/src/src/globals.c b/src/src/globals.c
index 1b09008a1..5cd738bbb 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -496,6 +496,7 @@ gid_t config_gid = CONFIGURE_GROUP;
uschar *config_main_filelist = US CONFIGURE_FILE
"\0<-----------Space to patch configure_filename->";
uschar *config_main_filename = NULL;
+uschar *config_main_directory = NULL;
#ifdef CONFIGURE_OWNER
uid_t config_uid = CONFIGURE_OWNER;
diff --git a/src/src/globals.h b/src/src/globals.h
index f4baa0bb0..5746167dd 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -282,6 +282,7 @@ extern gid_t config_gid; /* Additional group owner */
extern int config_lineno; /* Line number */
extern uschar *config_main_filelist; /* List of possible config files */
extern uschar *config_main_filename; /* File name actually used */
+extern uschar *config_main_directory; /* Directory where the main config file was found */
#ifdef CONFIGURE_OWNER
extern uid_t config_uid; /* Additional owner */
#endif
diff --git a/src/src/readconf.c b/src/src/readconf.c
index f0d08d0e1..df4cbb2fd 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -3008,7 +3008,12 @@ file is a serious disaster. */
if (config_file != NULL)
{
+ uschar *p;
config_filename = config_main_filename = string_copy(filename);
+
+ p = strrchr(filename, '/');
+ config_main_directory = p ? string_copyn(filename, p - filename)
+ : string_copy(".");
}
else
{