From 598c2103ae2617e38007e059f673166f7a5bd859 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 4 Feb 2011 21:58:22 +0100 Subject: [PATCH] use the new blobmsg string buffer functions --- listener.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/listener.c b/listener.c index 0111f09..f05506a 100644 --- 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; } -- 2.25.1