summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-03-27 11:54:09 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-04-04 07:28:49 (GMT)
commit5b128587ec25d575a683b9a37e6ac33ce17bd760 (patch)
treefb3fa6849dee433df84f3404acf7f50ad8e24ce4 /client
parent6833a8b5d5f079538a2d72f805900a5e00d790ca (diff)
downloadconnman-5b128587ec25d575a683b9a37e6ac33ce17bd760.zip
connman-5b128587ec25d575a683b9a37e6ac33ce17bd760.tar.gz
connman-5b128587ec25d575a683b9a37e6ac33ce17bd760.tar.bz2
client: Move boolean parsing helper function to commands file
The helper function is not used elsewhere, thus move it.
Diffstat (limited to 'client')
-rw-r--r--client/commands.c26
-rw-r--r--client/services.c26
-rw-r--r--client/services.h1
3 files changed, 26 insertions, 27 deletions
diff --git a/client/commands.c b/client/commands.c
index 8f9b718..ffa45ee 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -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;
diff --git a/client/services.c b/client/services.c
index b4bc0f6..045947c 100644
--- a/client/services.c
+++ b/client/services.c
@@ -35,32 +35,6 @@
#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;
diff --git a/client/services.h b/client/services.h
index f32498b..0af05ff 100644
--- a/client/services.h
+++ b/client/services.h
@@ -22,5 +22,4 @@
#include <dbus/dbus.h>
-int parse_boolean(char *arg);
void __connmanctl_services_list(DBusMessageIter *iter);