efl_* examples: improve usability of boolean options.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 22 Oct 2016 13:55:45 +0000 (11:55 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 22 Oct 2016 13:55:45 +0000 (11:55 -0200)
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
src/examples/ecore/efl_net_dialer_udp_example.c
src/examples/ecore/efl_net_dialer_websocket_example.c
src/examples/ecore/efl_net_server_example.c

index 81172a3..ca2f03b 100644 (file)
@@ -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"),
index 0ba367d..846a17c 100644 (file)
@@ -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"),
index 10a2bad..84e0140 100644 (file)
@@ -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"),
index 3c4c518..bab84da 100644 (file)
@@ -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",