home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / LIBSRC.ZOO / libsrc / local / writev.c < prev   
Text File  |  1992-01-27  |  471b  |  25 lines

  1. #include <sys/types.h>
  2. #include <sys/uio.h>
  3.  
  4. int writev (int fd, const struct iovec *iov, int iovcnt)
  5. {
  6.    int i;
  7.    int accum = 0;
  8.  
  9.    for (i = 0; i < iovcnt; ++i)
  10.    {
  11.       register count = iov[i].iov_len;
  12.       register thistime;
  13.  
  14.       while (count)
  15.       {
  16.          if ((thistime = write (fd, iov[i].iov_base, count)) <= 0)
  17.             return (-1);
  18.          count -= thistime;
  19.          accum += thistime;
  20.       }
  21.    }
  22.    return (accum);
  23. }
  24.  
  25.