projects
/
project
/
ubus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
875619e
)
use the new blobmsg string buffer functions
author
Felix Fietkau
<nbd@openwrt.org>
Fri, 4 Feb 2011 20:58:22 +0000
(21:58 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Fri, 4 Feb 2011 20:58:22 +0000
(21:58 +0100)
listener.c
patch
|
blob
|
history
diff --git
a/listener.c
b/listener.c
index 0111f09547ad8942e84e5ce7112158b511502273..f05506a3faceb86da252adcd1482b2582f3b22dd 100644
(file)
--- a/
listener.c
+++ b/
listener.c
@@
-20,8
+20,12
@@
static int test_hello(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
+ char *strbuf;
+
blob_buf_init(&b, 0);
- blobmsg_add_string(&b, "message", "Hello, world!\n");
+ strbuf = blobmsg_alloc_string_buffer(&b, "message", 64 + strlen(obj->name));
+ sprintf(strbuf, "%s: Hello, world\n", obj->name);
+ blobmsg_add_string_buffer(&b);
ubus_send_reply(ctx, req, b.head);
return 0;
}