client: Factor out state command
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 19 Feb 2013 19:34:15 +0000 (21:34 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 21 Feb 2013 14:22:56 +0000 (16:22 +0200)
client/commands.c

index 1aa2783..860c94b 100644 (file)
@@ -150,7 +150,10 @@ static int cmd_disable(char *args[], int num, struct option *options)
 
 static int cmd_state(char *args[], int num, struct option *options)
 {
-       return -1;
+       if (num > 1)
+               return -E2BIG;
+
+       return list_properties(connection, "GetProperties", NULL);
 }
 
 static int cmd_services(char *args[], int num, struct option *options)
@@ -498,14 +501,6 @@ int commands_no_options(DBusConnection *connection, char *argv[], int argc)
                cmd_help(NULL, 0, NULL);
                printf("\nNote: arguments and output are considered "
                                "EXPERIMENTAL for now.\n\n");
-       } else if (strcmp(argv[0], "state") == 0) {
-               if (argc != 1) {
-                       fprintf(stderr, "State cannot accept an argument, "
-                                                               "see help\n");
-                       error = -EINVAL;
-               } else
-                       error = list_properties(connection,
-                                               "GetProperties", NULL);
        } else if (strcmp(argv[0], "technologies") == 0) {
                if (argc != 1) {
                        fprintf(stderr, "Tech cannot accept an argument, "