textclient_commandv.c (495B)
1 /* ISC license. */ 2 3 #include <sys/uio.h> 4 #include <errno.h> 5 6 #include <skalibs/textclient.h> 7 #include <skalibs/posixishard.h> 8 9 int textclient_commandv (textclient *a, struct iovec const *v, unsigned int n, tain const *deadline, tain *stamp) 10 { 11 struct iovec ans ; 12 if (!textclient_exchangev(a, v, n, &ans, deadline, stamp)) return 0 ; 13 if (ans.iov_len != 1) return (errno = EPROTO, 0) ; 14 if (*(unsigned char *)ans.iov_base) return (errno = *(unsigned char *)ans.iov_base, 0) ; 15 return 1 ; 16 }