client: Move boolean parsing helper function to commands file
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Wed, 27 Mar 2013 11:54:09 +0000 (13:54 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 4 Apr 2013 07:28:49 +0000 (10:28 +0300)
The helper function is not used elsewhere, thus move it.

client/commands.c
client/services.c
client/services.h

index 8f9b71859b7f05eb2767846f280ade7b2b1064bf..ffa45ee292ed375ce12a880f224e6d233bc0e619 100644 (file)
@@ -59,6 +59,32 @@ static char *ipv6[] = {
 
 static int cmd_help(char *args[], int num, struct option *options);
 
+static int parse_boolean(char *arg)
+{
+       if (arg == NULL)
+               return -1;
+
+       if (strcasecmp(arg, "no") == 0 ||
+                       strcasecmp(arg, "false") == 0 ||
+                       strcasecmp(arg, "off" ) == 0 ||
+                       strcasecmp(arg, "disable" ) == 0 ||
+                       strcasecmp(arg, "n") == 0 ||
+                       strcasecmp(arg, "f") == 0 ||
+                       strcasecmp(arg, "0") == 0)
+               return 0;
+
+       if (strcasecmp(arg, "yes") == 0 ||
+                       strcasecmp(arg, "true") == 0 ||
+                       strcasecmp(arg, "on") == 0 ||
+                       strcasecmp(arg, "enable" ) == 0 ||
+                       strcasecmp(arg, "y") == 0 ||
+                       strcasecmp(arg, "t") == 0 ||
+                       strcasecmp(arg, "1") == 0)
+               return 1;
+
+       return -1;
+}
+
 static int parse_args(char *arg, struct option *options)
 {
        int i;
index b4bc0f65d72b0467c2088b8aac8d6fb7d08ffb4a..045947c82e54f214ce139d42b1f774d3dbf11f50 100644 (file)
 
 #include "services.h"
 
-int parse_boolean(char *arg)
-{
-       if (arg == NULL)
-               return -1;
-
-       if (strcasecmp(arg, "no") == 0 ||
-                       strcasecmp(arg, "false") == 0 ||
-                       strcasecmp(arg, "off" ) == 0 ||
-                       strcasecmp(arg, "disable" ) == 0 ||
-                       strcasecmp(arg, "n") == 0 ||
-                       strcasecmp(arg, "f") == 0 ||
-                       strcasecmp(arg, "0") == 0)
-               return 0;
-
-       if (strcasecmp(arg, "yes") == 0 ||
-                       strcasecmp(arg, "true") == 0 ||
-                       strcasecmp(arg, "on") == 0 ||
-                       strcasecmp(arg, "enable" ) == 0 ||
-                       strcasecmp(arg, "y") == 0 ||
-                       strcasecmp(arg, "t") == 0 ||
-                       strcasecmp(arg, "1") == 0)
-               return 1;
-
-       return -1;
-}
-
 static void print_service(char *path, DBusMessageIter *iter)
 {
        char *name = "", *str = NULL;
index f32498bd85325f75a8de1f94abb49c08888c793a..0af05ff6ae0a032bcdcfdb3d24a95841d0afd7a1 100644 (file)
@@ -22,5 +22,4 @@
 
 #include <dbus/dbus.h>
 
-int parse_boolean(char *arg);
 void __connmanctl_services_list(DBusMessageIter *iter);