do not reverse method sorting order
[project/ubus.git] / cli.c
diff --git a/cli.c b/cli.c
index d020b8e..be8ba23 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -4,10 +4,12 @@
 #include "libubus.h"
 
 static struct blob_buf b;
+static int timeout = 30;
 
 static const char *format_type(void *priv, struct blob_attr *attr)
 {
        static const char * const attr_types[] = {
+               [BLOBMSG_TYPE_INT8] = "\"Boolean\"",
                [BLOBMSG_TYPE_INT32] = "\"Integer\"",
                [BLOBMSG_TYPE_STRING] = "\"String\"",
        };
@@ -96,7 +98,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int argc, char **argv)
        if (ret)
                return ret;
 
-       return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, NULL);
+       return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, NULL, timeout * 1000);
 }
 
 static int ubus_cli_listen(struct ubus_context *ctx, int argc, char **argv)
@@ -194,11 +196,14 @@ int main(int argc, char **argv)
 
        progname = argv[0];
 
-       while ((ch = getopt(argc, argv, "s:")) != -1) {
+       while ((ch = getopt(argc, argv, "s:t:")) != -1) {
                switch (ch) {
                case 's':
                        ubus_socket = optarg;
                        break;
+               case 't':
+                       timeout = atoi(optarg);
+                       break;
                default:
                        return usage(progname);
                }