shithub: riscv

ref: 232a064f3a9afcd9a5c1de45f1558e4522c511bd
dir: /sys/src/liboventi/readfully.c/

View raw version
#include <u.h>
#include <libc.h>
#include <oventi.h>
#include "session.h"

int
vtFdReadFully(int fd, uchar *p, int n)
{
	int nn;

	while(n > 0) {
		nn = vtFdRead(fd, p, n);
		if(nn <= 0)
			return 0;
		n -= nn;
		p += nn;
	}
	return 1;
}