summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-23 05:24:05 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-23 05:24:05 +0200
commitea4a240dc2e70adcb39704542b1422b1608e76e6 (patch)
tree36569749995d2de1e6bcd8a7bdda7de86ff331c6 /src
parent7a58bfa4aef88c9ddead6668d83640f762938e72 (diff)
systemctl: accept -p more than once
Diffstat (limited to 'src')
-rw-r--r--src/systemctl.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index d78294b6d8..de928c5661 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -47,7 +47,7 @@
#include "list.h"
static const char *arg_type = NULL;
-static const char *arg_property = NULL;
+static char **arg_property = NULL;
static bool arg_all = false;
static bool arg_fail = false;
static bool arg_session = false;
@@ -1702,7 +1702,7 @@ static int print_property(const char *name, DBusMessageIter *iter) {
/* This is a low-level property printer, see
* print_status_info() for the nicer output */
- if (arg_property && !streq(name, arg_property))
+ if (arg_property && !strv_find(arg_property, name))
return 0;
switch (dbus_message_iter_get_arg_type(iter)) {
@@ -3089,14 +3089,21 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_type = optarg;
break;
- case 'p':
- arg_property = optarg;
+ case 'p': {
+ char **l;
+
+ if (!(l = strv_append(arg_property, optarg)))
+ return -ENOMEM;
+
+ strv_free(arg_property);
+ arg_property = l;
/* If the user asked for a particular
* property, show it to him, even if it is
* empty. */
arg_all = true;
break;
+ }
case 'a':
arg_all = true;
@@ -3927,5 +3934,7 @@ finish:
dbus_shutdown();
+ strv_free(arg_property);
+
return retval;
}