summaryrefslogtreecommitdiff
path: root/src/shared/macro.h
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2014-10-29 05:02:56 -0700
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-11-26 19:11:37 -0500
commit7f0a55d4325f7df91f91b3b818f61f97d78df14a (patch)
treef88b96f4a0002b49749d78622fd174d54062e9f8 /src/shared/macro.h
parent3d82301321afdcc4f2f8786883bd15b1a64c6e83 (diff)
Introduce CONF_DIRS_NULSTR helper to define standard conf dirs
Several different systemd tools define a nulstr containing a standard series of configuration file directories, in /etc, /run, /usr/local/lib, /usr/lib, and (#ifdef HAVE_SPLIT_USR) /lib. Factor that logic out into a new helper macro, CONF_DIRS_NULSTR.
Diffstat (limited to 'src/shared/macro.h')
-rw-r--r--src/shared/macro.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 9ee332c8df..6d4712c30d 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -384,6 +384,21 @@ do { \
_found; \
})
+/* Return a nulstr for a standard cascade of configuration directories,
+ * suitable to pass to conf_files_list_nulstr or config_parse_many. */
+#define CONF_DIRS_NULSTR(n) \
+ "/etc/" n ".d\0" \
+ "/run/" n ".d\0" \
+ "/usr/local/lib/" n ".d\0" \
+ "/usr/lib/" n ".d\0" \
+ CONF_DIR_SPLIT_USR(n)
+
+#ifdef HAVE_SPLIT_USR
+#define CONF_DIR_SPLIT_USR(n) "/lib/" n ".d\0"
+#else
+#define CONF_DIR_SPLIT_USR(n)
+#endif
+
/* Define C11 thread_local attribute even on older gcc compiler
* version */
#ifndef thread_local