summaryrefslogtreecommitdiff
path: root/src/libunixonacid/textclient_commandv.c
blob: f7a2a056c9ed84b0e1269cca2131dca1379d8c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* ISC license. */

#include <sys/uio.h>
#include <errno.h>

#include <skalibs/textclient.h>
#include <skalibs/posixishard.h>

int textclient_commandv (textclient *a, struct iovec const *v, unsigned int n, tain const *deadline, tain *stamp)
{
  struct iovec ans ;
  if (!textclient_exchangev(a, v, n, &ans, deadline, stamp)) return 0 ;
  if (ans.iov_len != 1) return (errno = EPROTO, 0) ;
  if (*(unsigned char *)ans.iov_base) return (errno = *(unsigned char *)ans.iov_base, 0) ;
  return 1 ;
}