diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-29 19:28:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 19:28:39 +0100 |
commit | 67400285167cd8cea0eb1e335500b311931243c3 (patch) | |
tree | d36143780fa17dbf80a17f9d5e344a3f9e0e40e3 /src/machine | |
parent | 401faa3533280b05fee972e0c64885caf4b31e4c (diff) | |
parent | f2cca38e46b0dc25b26bce1519d9507cf67dd137 (diff) | |
download | systemd-67400285167cd8cea0eb1e335500b311931243c3.tar.gz systemd-67400285167cd8cea0eb1e335500b311931243c3.tar.bz2 systemd-67400285167cd8cea0eb1e335500b311931243c3.zip |
Merge pull request #10989 from keszybz/nss-man
Add example to nss-mymachines(8)
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machinectl.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index a49b11e7b0..5023acb5e2 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -332,7 +332,7 @@ static int list_machines(int argc, char *argv[], void *userdata) { name, 0, "", - "", + " ", arg_addrs, &addresses); @@ -475,20 +475,6 @@ static int show_unit_cgroup(sd_bus *bus, const char *unit, pid_t leader) { return 0; } -static int print_addresses(sd_bus *bus, const char *name, int ifi, const char *prefix, const char *prefix2, int n_addr) { - _cleanup_free_ char *s = NULL; - int r; - - r = call_get_addresses(bus, name, ifi, prefix, prefix2, n_addr, &s); - if (r < 0) - return r; - - if (r > 0) - fputs(s, stdout); - - return r; -} - static int print_os_release(sd_bus *bus, const char *method, const char *name, const char *prefix) { _cleanup_free_ char *pretty = NULL; int r; @@ -561,6 +547,7 @@ static void machine_status_info_clear(MachineStatusInfo *info) { static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) { char since1[FORMAT_TIMESTAMP_RELATIVE_MAX]; char since2[FORMAT_TIMESTAMP_MAX]; + _cleanup_free_ char *addresses = NULL; const char *s1, *s2; int ifi = -1; @@ -630,11 +617,12 @@ static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) { fputc('\n', stdout); } - if (print_addresses(bus, i->name, ifi, - "\t Address: ", - "\n\t ", - ALL_IP_ADDRESSES) > 0) + if (call_get_addresses(bus, i->name, ifi, + "\t Address: ", "\n\t ", ALL_IP_ADDRESSES, + &addresses) > 0) { + fputs(addresses, stdout); fputc('\n', stdout); + } print_os_release(bus, "GetMachineOSRelease", i->name, "\t OS: "); |