gno/lib/netdb/writev.c
1998-01-24 07:05:48 +00:00

23 lines
419 B
C

#include <sys/types.h>
#include <unistd.h>
#include <sys/uio.h>
#include "protos.h"
/* MAJOR HACK ALERT! This won't work right for packet based sockets! */
size_t writev(int fd, struct iovec *iov, int iovcnt)
{
int i;
size_t size, total_size = 0;
for (i=0; i<iovcnt; i++) {
size = write(fd, iov[i].iov_base, iov[i].iov_len);
total_size += size;
if (size != iov[i].iov_len) break;
}
return total_size;
}