vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

writebuf.c (297B)


      1 
      2 #include <unistd.h>
      3 
      4 #include "ioprivate.h"
      5 
      6 
      7 int __writebuf(FILE *f, const void *buf, size_t size)
      8 {
      9 	const char *lo = buf;
     10 	const char *hi = lo + size;
     11 	while (lo < hi) {
     12 		ssize_t rc = write(f->fd, lo, hi-lo);
     13 		if (rc < 0) {
     14 			f->errflag = 1;
     15 			return EOF;
     16 		}
     17 		lo += rc;
     18 	}
     19 	return 0;
     20 }
     21