diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-12-22 14:46:04 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-12-22 14:46:04 +0000 |
commit | 3c1ff1523587881324fc540fece06412c29c66de (patch) | |
tree | ecd5431551ebe81793a33297b86f26d90e12047a /src/libunixonacid/textclient_command.c | |
parent | f3c9c3c70187967a670f1c059f5461dce745d92e (diff) | |
download | skalibs-3c1ff1523587881324fc540fece06412c29c66de.tar.xz |
Add textclient, fix some textmessage issues
Diffstat (limited to 'src/libunixonacid/textclient_command.c')
-rw-r--r-- | src/libunixonacid/textclient_command.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libunixonacid/textclient_command.c b/src/libunixonacid/textclient_command.c new file mode 100644 index 0000000..2e72a4c --- /dev/null +++ b/src/libunixonacid/textclient_command.c @@ -0,0 +1,15 @@ +/* ISC license. */ + +#include <sys/uio.h> +#include <errno.h> +#include <skalibs/error.h> +#include <skalibs/textclient.h> + +int textclient_command (textclient_t *a, char const *s, size_t len, tain_t const *deadline, tain_t *stamp) +{ + struct iovec ans ; + if (!textclient_exchange(a, s, len, &ans, deadline, stamp)) return 0 ; + if (ans.iov_len != 1) return (errno = EPROTO, 0) ; + if (*(char *)ans.iov_base) return (errno = *(char *)ans.iov_base, 0) ; + return 1 ; +} |