<command>systemd-analyze</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
<arg choice="plain">cat-config</arg>
- <arg choice="plain" rep="repeat"><replaceable>NAME</replaceable></arg>
+ <arg choice="plain" rep="repeat"><replaceable>NAME</replaceable>|<replaceable>PATH</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>systemd-analyze</command>
to <command>systemctl cat</command>, but operates on config files.
It will copy the contents of a config file and any drop-ins to standard
output, using the usual systemd set of directories and rules for
- precedence.</para>
+ precedence. Each argument must be either an absolute path including
+ the prefix (such as <filename>/etc/systemd/logind.conf</filename> or
+ <filename>/usr/lib/systemd/logind.conf</filename>), or a name
+ relative to the prefix (such as <filename>systemd/logind.conf</filename>).
+ </para>
<example>
<title>Showing logind configuration</title>
#include "bus-unit-util.h"
#include "bus-util.h"
#include "calendarspec.h"
+#include "def.h"
#include "conf-files.h"
#include "glob-util.h"
#include "hashmap.h"
(void) pager_open(arg_no_pager, false);
STRV_FOREACH(arg, argv + 1) {
+ const char *t = NULL;
+
if (arg != argv + 1)
printf("%s%*s%s\n\n",
ansi_underline(),
ansi_normal());
if (path_is_absolute(*arg)) {
- log_error("Arguments must be config file names (relative to /etc/");
- return -EINVAL;
- }
+ const char *dir;
+
+ NULSTR_FOREACH(dir, CONF_PATHS_NULSTR("")) {
+ t = path_startswith(*arg, dir);
+ if (t)
+ break;
+ }
+
+ if (!t) {
+ log_error("Path %s does not start with any known prefix.", *arg);
+ return -EINVAL;
+ }
+ } else
+ t = *arg;
- r = conf_files_cat(arg_root, *arg);
+ r = conf_files_cat(arg_root, t);
if (r < 0)
return r;
}