textclient_command.c (483B)
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_command (textclient *a, char const *s, size_t len, tain const *deadline, tain *stamp) 10 { 11 struct iovec ans ; 12 if (!textclient_exchange(a, s, len, &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 }