aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/msg.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-06-09 00:10:02 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-06-09 00:10:13 +0200
commitcc7c91c8ea38ac4cd226469481c2f6d63805331b (patch)
tree3f7816ae011b83f6baca597e3342e794721a51b2 /src/msg.c
parentadd {file,net}_close as a wrapper to close(2) (diff)
downloadcimple-cc7c91c8ea38ac4cd226469481c2f6d63805331b.tar.gz
cimple-cc7c91c8ea38ac4cd226469481c2f6d63805331b.zip
msg: add msg_send_from_argv shortcut
Diffstat (limited to '')
-rw-r--r--src/msg.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/msg.c b/src/msg.c
index 7bce01d..0e75c75 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -170,6 +170,23 @@ destroy_buf:
return ret;
}
+int msg_send_from_argv(int fd, const char **argv)
+{
+ struct msg *msg = NULL;
+ int ret = 0;
+
+ ret = msg_from_argv(&msg, argv);
+ if (ret < 0)
+ return ret;
+
+ ret = msg_send(fd, msg);
+ msg_free(msg);
+ if (ret < 0)
+ return ret;
+
+ return ret;
+}
+
int msg_recv(int fd, struct msg **_msg)
{
struct buf *buf = NULL;