From 285f5c09e7ada7e122adc913647d3735fc3bccc2 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 22 Oct 2016 11:55:45 -0200 Subject: [PATCH] efl_* examples: improve usability of boolean options. Instead of using 'bool', which requires a parameter to be useful, make them toggle of the default value. Adapt names to make more sense in that context. --- src/examples/ecore/efl_net_dialer_http_example.c | 4 ++-- src/examples/ecore/efl_net_dialer_udp_example.c | 6 +++--- src/examples/ecore/efl_net_dialer_websocket_example.c | 4 ++-- src/examples/ecore/efl_net_server_example.c | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/examples/ecore/efl_net_dialer_http_example.c b/src/examples/ecore/efl_net_dialer_http_example.c index 81172a3..ca2f03b 100644 --- a/src/examples/ecore/efl_net_dialer_http_example.c +++ b/src/examples/ecore/efl_net_dialer_http_example.c @@ -179,8 +179,8 @@ static const Ecore_Getopt options = { ECORE_GETOPT_STORE_STR('U', "username", "Authentication username"), ECORE_GETOPT_STORE_STR('P', "password", "Authentication password"), ECORE_GETOPT_CHOICE('A', "authentication-method", "Authentication method", authentication_method_choices), - ECORE_GETOPT_STORE_BOOL('R', "authentication-restricted", "Authentication method must be restricted"), - ECORE_GETOPT_STORE_BOOL('r', "allow-redirects", "allow redirections by following 'Location:' headers"), + ECORE_GETOPT_STORE_TRUE('R', "authentication-restricted", "Authentication method must be restricted"), + ECORE_GETOPT_STORE_FALSE('r', "disallow-redirects", "disallow redirections by following 'Location:' headers. Allowed by default."), ECORE_GETOPT_STORE_DOUBLE('t', "connect-timeout", "timeout in seconds for the connection phase"), ECORE_GETOPT_APPEND('H', "header", "Add custom headers. Format must be 'Key: Value'", ECORE_GETOPT_TYPE_STR), ECORE_GETOPT_STORE_STR('X', "proxy", "Set a specific proxy for the connection"), diff --git a/src/examples/ecore/efl_net_dialer_udp_example.c b/src/examples/ecore/efl_net_dialer_udp_example.c index 0ba367d..846a17c 100644 --- a/src/examples/ecore/efl_net_dialer_udp_example.c +++ b/src/examples/ecore/efl_net_dialer_udp_example.c @@ -149,9 +149,9 @@ static const Ecore_Getopt options = { "Example of Efl_Net_Dialer_Udp usage, sending a message and receiving a reply\n", EINA_FALSE, { - ECORE_GETOPT_STORE_BOOL('r', "read-after-write", "Do a read after writes are done."), - ECORE_GETOPT_STORE_BOOL('c', "cork", "use UDP_CORK around messages to generate a single datagram."), - ECORE_GETOPT_STORE_BOOL('R', "dont-route", "Do not route packets via a gateway."), + ECORE_GETOPT_STORE_TRUE('r', "read-after-write", "Do a read after writes are done."), + ECORE_GETOPT_STORE_TRUE('c', "cork", "use UDP_CORK around messages to generate a single datagram."), + ECORE_GETOPT_STORE_TRUE('R', "dont-route", "Do not route packets via a gateway."), ECORE_GETOPT_STORE_DOUBLE('t', "connect-timeout", "timeout in seconds for the connection phase"), ECORE_GETOPT_VERSION('V', "version"), ECORE_GETOPT_COPYRIGHT('C', "copyright"), diff --git a/src/examples/ecore/efl_net_dialer_websocket_example.c b/src/examples/ecore/efl_net_dialer_websocket_example.c index 10a2bad..84e0140 100644 --- a/src/examples/ecore/efl_net_dialer_websocket_example.c +++ b/src/examples/ecore/efl_net_dialer_websocket_example.c @@ -209,8 +209,8 @@ static const Ecore_Getopt options = { ECORE_GETOPT_STORE_STR('U', "username", "Authentication username"), ECORE_GETOPT_STORE_STR('P', "password", "Authentication password"), ECORE_GETOPT_CHOICE('A', "authentication-method", "Authentication method", authentication_method_choices), - ECORE_GETOPT_STORE_BOOL('R', "authentication-restricted", "Authentication method must be restricted"), - ECORE_GETOPT_STORE_BOOL('r', "allow-redirects", "allow redirections by following 'Location:' headers"), + ECORE_GETOPT_STORE_TRUE('R', "authentication-restricted", "Authentication method must be restricted"), + ECORE_GETOPT_STORE_FALSE('r', "disallow-redirects", "disallow redirections by following 'Location:' headers. Allowed by default."), ECORE_GETOPT_STORE_DOUBLE('t', "connect-timeout", "timeout in seconds for the connection phase"), ECORE_GETOPT_APPEND('H', "header", "Add custom headers. Format must be 'Key: Value'", ECORE_GETOPT_TYPE_STR), ECORE_GETOPT_STORE_STR('X', "proxy", "Set a specific proxy for the connection"), diff --git a/src/examples/ecore/efl_net_server_example.c b/src/examples/ecore/efl_net_server_example.c index 3c4c518..bab84da 100644 --- a/src/examples/ecore/efl_net_server_example.c +++ b/src/examples/ecore/efl_net_server_example.c @@ -477,14 +477,14 @@ static const Ecore_Getopt options = { "This example spawns a server of the given protocol at the given address.", EINA_FALSE, { - ECORE_GETOPT_STORE_BOOL('e', "echo", - "If true, will send back to client all the data receive (echo server)"), + ECORE_GETOPT_STORE_TRUE('e', "echo", + "Behave as 'echo' server, send back to client all the data receive"), ECORE_GETOPT_STORE_UINT('l', "clients-limit", "If set will limit number of clients to accept"), - ECORE_GETOPT_STORE_BOOL('r', "clients-reject-excess", - "If true, excess clients will be immediately rejected."), - ECORE_GETOPT_STORE_BOOL(0, "ipv6-only", - "If true (default), only IPv6 clients will be allowed for a server if an IPv6 was used, otherwise IPv4 clients will be automatically converted into IPv6 and handled transparently."), + ECORE_GETOPT_STORE_TRUE('r', "clients-reject-excess", + "Immediately reject excess clients (over limit)"), + ECORE_GETOPT_STORE_FALSE(0, "ipv4-on-ipv6", + "IPv4 clients will be automatically converted into IPv6 and handled transparently."), ECORE_GETOPT_STORE_DOUBLE('t', "inactivity-timeout", "The timeout in seconds to disconnect a client. The timeout is restarted for each client when there is some activity. It's particularly useful for UDP where there is no disconnection event."), @@ -494,7 +494,7 @@ static const Ecore_Getopt options = { ECORE_GETOPT_HELP('h', "help"), ECORE_GETOPT_CATEGORY("udp", "UDP options"), - ECORE_GETOPT_STORE_BOOL(0, "udp-dont-route", + ECORE_GETOPT_STORE_TRUE(0, "udp-dont-route", "If true, datagrams won't be routed using a gateway, being restricted to the local network."), ECORE_GETOPT_CHOICE_METAVAR(0, NULL, "The server protocol.", "protocol", -- 2.7.4