From: Felix Fietkau Date: Mon, 31 Jan 2011 16:27:08 +0000 (+0100) Subject: cli: use ubus_invoke() instead of low level handling X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=23c9984a6cfe110f0112296d337978862ab34123;p=oweals%2Fubus.git cli: use ubus_invoke() instead of low level handling --- diff --git a/cli.c b/cli.c index a1c90fe..45addc6 100644 --- a/cli.c +++ b/cli.c @@ -96,6 +96,7 @@ int main(int argc, char **argv) ubus_start_request(ctx, &req, b.head, UBUS_MSG_LOOKUP, 0); req.raw_data_cb = receive_lookup; + ret = ubus_complete_request(ctx, &req); } else if (!strcmp(cmd, "call")) { if (argc < 4 || argc > 5) return usage(argv[0]); @@ -105,16 +106,11 @@ int main(int argc, char **argv) return 1; } - blob_buf_init(&b, 0); - blob_put_int32(&b, UBUS_ATTR_OBJID, objid); - blob_put_string(&b, UBUS_ATTR_METHOD, argv[3]); - ubus_start_request(ctx, &req, b.head, UBUS_MSG_INVOKE, objid); - req.data_cb = receive_data; + ret = ubus_invoke(ctx, objid, argv[3], NULL, receive_data, NULL); } else { return usage(argv[0]); } - ret = ubus_complete_request(ctx, &req); if (ret) fprintf(stderr, "Failed: %s\n", ubus_strerror(ret));