]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/bus-get-properties.c
bus-util: introduce bus_property_get_tristate()
[thirdparty/systemd.git] / src / shared / bus-get-properties.c
index 8b4f66b22e91ccdcf7b1899f774754fa98158ed1..3d0887e6df72ea4b61bc8967c6f00d274676bc59 100644 (file)
@@ -38,6 +38,22 @@ int bus_property_set_bool(
         return 0;
 }
 
+int bus_property_get_tristate(
+                sd_bus *bus,
+                const char *path,
+                const char *interface,
+                const char *property,
+                sd_bus_message *reply,
+                void *userdata,
+                sd_bus_error *error) {
+
+        /* Defaults to false. */
+
+        int b = (*(int*) userdata) > 0;
+
+        return sd_bus_message_append_basic(reply, 'b', &b);
+}
+
 int bus_property_get_id128(
                 sd_bus *bus,
                 const char *path,