home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / ISP / bind.4.8.3.lzh / BIND483 / RES / writev.c < prev    next >
C/C++ Source or Header  |  1994-09-22  |  404b  |  23 lines

  1. #include "uio.h"
  2.  
  3. int writev(fildes, iov, iovcnt)
  4. int fildes;
  5. struct iovec *iov;
  6. int iovcnt;
  7. {
  8.    int count = 0, res;
  9.  
  10.    while( iovcnt-- > 0 ) {
  11.       if ( iov->iov_len > 0 ) {
  12.          res = write(fildes, iov->iov_base, iov->iov_len);
  13.          count += res;
  14.          if ( res == 0 )
  15.             return count;
  16.          if ( res < 0 )
  17.             return res;
  18.       }
  19.       iov++;
  20.    }
  21.    return count;
  22. }
  23.