Updated connman to version 1.35
[platform/upstream/connman.git] / client / services.c
old mode 100644 (file)
new mode 100755 (executable)
index b4bc0f6..0c18669
 
 #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;
@@ -83,11 +57,17 @@ static void print_service(char *path, DBusMessageIter *iter)
                        dbus_message_iter_recurse(&entry, &val);
                        dbus_message_iter_get_basic(&val, &str);
 
-                       if (str != NULL) {
+                       if (str) {
                                if (strcmp(str, "online") == 0)
                                        state = 'O';
                                else if (strcmp(str, "ready") == 0)
                                        state = 'R';
+                               else if (!strcmp(str, "association"))
+                                       state = 'a';
+                               else if (!strcmp(str, "configuration"))
+                                       state = 'c';
+                               else if (!strcmp(str, "disconnect"))
+                                       state = 'd';
                        }
 
                } else if (strcmp(property, "AutoConnect") == 0) {
@@ -106,18 +86,15 @@ static void print_service(char *path, DBusMessageIter *iter)
        }
 
        str = strrchr(path, '/');
-       if (str != NULL)
+       if (str)
                str++;
        else
                str = path;
 
-       if (count > 0) {
-               if (*name == '\0')
-                       name = "<hidden>";
-
+       if (count > 0)
                fprintf(stdout, "%c%c%c %-20s %s", favorite != 0 ? '*' : ' ',
                                autoconn != 0 ? 'A' : ' ', state, name, str);
-       else
+       else
                fprintf(stdout, "%-24s %s", "unchanged", str);
 
 }
@@ -143,7 +120,7 @@ static void list_service_array(DBusMessageIter *iter)
                        print_service(path, &dict);
                }
 
-               if (dbus_message_iter_has_next(iter) == TRUE)
+               if (dbus_message_iter_has_next(iter))
                        fprintf(stdout, "\n");
 
                dbus_message_iter_next(iter);