eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit bb33c5db8c4b8744c79ad72eaddcc568ef296df1
parent f5674a2356d4aed5aac239c995eccda06e8e8a75
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date:   Wed, 10 Apr 2019 15:58:20 -0700

client: Add 'Yes', 'No' property type support

This property type will be used for the argument completion among
the properties that require Yes or No value.

Diffstat:
Mclient/properties.c | 20++++++++++++++++++++
Mclient/properties.h | 5+++++
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/client/properties.c b/client/properties.c @@ -29,6 +29,7 @@ #include "properties.h" const char *properties_on_off_opts[3] = { "on", "off", NULL }; +const char *properties_yes_no_opts[3] = { "yes", "no", NULL }; bool properties_builder_append_on_off_variant( struct l_dbus_message_builder *builder, @@ -48,3 +49,22 @@ bool properties_builder_append_on_off_variant( return l_dbus_message_builder_append_basic(builder, 'b', &value); } + +bool properties_builder_append_yes_no_variant( + struct l_dbus_message_builder *builder, + const char *value_str) +{ + bool value; + + if (!builder || !value_str) + return false; + + if (!strcmp(value_str, "yes")) + value = true; + else if (!strcmp(value_str, "no")) + value = false; + else + return false; + + return l_dbus_message_builder_append_basic(builder, 'b', &value); +} diff --git a/client/properties.h b/client/properties.h @@ -21,7 +21,12 @@ */ const char *properties_on_off_opts[3]; +const char *properties_yes_no_opts[3]; bool properties_builder_append_on_off_variant( struct l_dbus_message_builder *builder, const char *value_str); + +bool properties_builder_append_yes_no_variant( + struct l_dbus_message_builder *builder, + const char *value_str);