chiark / gitweb /
core: rearrange code so that libsystemd/sd-bus/ does not include header files from...
[elogind.git] / src / libsystemd / sd-bus / busctl.c
index 229a1cf9a237a02ddf4c1f68ed67ee33863fd1b7..3233c1b29b14f1a05184421fd27124e0dd6f8f1e 100644 (file)
@@ -28,6 +28,7 @@
 #include "pager.h"
 #include "xml.h"
 #include "path-util.h"
+#include "set.h"
 
 #include "sd-bus.h"
 #include "bus-message.h"
@@ -538,7 +539,7 @@ static int format_cmdline(sd_bus_message *m, FILE *f, bool needs_space) {
                                 fprintf(f, "%s", contents);
                         }
 
-                        r = format_cmdline(m, f, true);
+                        r = format_cmdline(m, f, needs_space || IN_SET(type, SD_BUS_TYPE_ARRAY, SD_BUS_TYPE_VARIANT));
                         if (r < 0)
                                 return r;
 
@@ -614,6 +615,7 @@ static int format_cmdline(sd_bus_message *m, FILE *f, bool needs_space) {
                         assert_not_reached("Unknown basic type.");
                 }
 
+                needs_space = true;
         }
 }
 
@@ -1176,11 +1178,20 @@ static int status(sd_bus *bus, char *argv[]) {
                                         pid,
                                         _SD_BUS_CREDS_ALL);
         } else {
-                const char *scope;
+                const char *scope, *address;
+                sd_id128_t bus_id;
+
+                r = sd_bus_get_address(bus, &address);
+                if (r >= 0)
+                        printf("BusAddress=%s%s%s\n", ansi_highlight(), address, ansi_highlight_off());
 
                 r = sd_bus_get_scope(bus, &scope);
                 if (r >= 0)
-                        printf("Scope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
+                        printf("BusScope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
+
+                r = sd_bus_get_bus_id(bus, &bus_id);
+                if (r >= 0)
+                        printf("BusID=%s" SD_ID128_FORMAT_STR "%s\n", ansi_highlight(), SD_ID128_FORMAT_VAL(bus_id), ansi_highlight_off());
 
                 r = sd_bus_get_owner_creds(
                                 bus,