static int show_all_names(sd_bus *bus) {
StatusInfo info = {};
- const struct bus_properties_map map[] = {
- { "s", "Hostname", &info.hostname },
- { "s", "StaticHostname", &info.static_hostname },
- { "s", "PrettyHostname", &info.pretty_hostname },
- { "s", "IconName", &info.icon_name },
- { "s", "Chassis", &info.chassis },
+ static const struct bus_properties_map map[] = {
+ { "Hostname", "s", NULL, offsetof(StatusInfo, hostname) },
+ { "StaticHostname", "s", NULL, offsetof(StatusInfo, static_hostname) },
+ { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) },
+ { "IconName", "s", NULL, offsetof(StatusInfo, icon_name) },
+ { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) },
{}
};
int r;
r = bus_map_all_properties(bus,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
- map);
+ map,
+ &info);
if (r < 0)
goto fail;
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "hHM:P", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "hH:M:", options, NULL)) >= 0) {
switch (c) {
}
int main(int argc, char *argv[]) {
- int r;
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
setlocale(LC_ALL, "");
log_parse_environment();