summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-01-18 00:36:12 +0100
committerLennart Poettering <lennart@poettering.net>2013-01-18 00:36:12 +0100
commite31165b26212b45e135fd4cd7d618a081d50bd28 (patch)
tree9b3caf6d4a6df4acc88c0945ded35e9bfaee4513 /src/systemctl
parente608b38a87fde7fd0b882c96ff235b26660ce074 (diff)
systemctl: make list-dependencies default to default.target
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 003b70647e..356854353c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -905,20 +905,24 @@ finish:
}
static int list_dependencies(DBusConnection *bus, char **args) {
- int r = 0;
_cleanup_free_ char *unit = NULL;
+ const char *u;
assert(bus);
- assert(args[1]);
- unit = unit_name_mangle(args[1]);
- if (!unit)
- return log_oom();
+ if (args[1]) {
+ unit = unit_name_mangle(args[1]);
+ if (!unit)
+ return log_oom();
+ u = unit;
+ } else
+ u = SPECIAL_DEFAULT_TARGET;
pager_open_if_enabled();
- printf("%s\n", unit);
- r = list_dependencies_one(bus, unit, 0, NULL, 0);
- return r;
+
+ puts(u);
+
+ return list_dependencies_one(bus, u, 0, NULL, 0);
}
static int dot_one_property(const char *name, const char *prop, DBusMessageIter *iter) {
@@ -5301,7 +5305,7 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
{ "unmask", MORE, 2, enable_unit },
{ "link", MORE, 2, enable_unit },
{ "switch-root", MORE, 2, switch_root },
- { "list-dependencies", EQUAL, 2, list_dependencies },
+ { "list-dependencies", LESS, 2, list_dependencies },
};
int left;