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>2015-01-12 18:58:34 +0000
commit98b8312fe7bf50e38c4a6dbc9f7592d2db134f36 (patch)
treeb17eee6bc6dc08c1dbdcca479866e1a82f72e617 /src
parente8bc7fca1bef99f0b14fe791594be95cfed134f2 (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 d2f215dfd..0e9dff27f 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
{