add readn to avoid need for plan9port libc

This commit is contained in:
rsc 2004-12-27 00:36:40 +00:00
parent 93f2ae0d92
commit 2b9172c7d4
2 changed files with 20 additions and 0 deletions

View file

@ -22,6 +22,25 @@ static int dolong = 1;
static void atimes(char *);
static char *split(char*, char**);
long
readn(int f, void *av, long n)
{
char *a;
long m, t;
a = av;
t = 0;
while(t < n){
m = read(f, a+t, n-t);
if(m <= 0){
if(t == 0)
return m;
break;
}
t += m;
}
return t;
}
long
atimeof(int force, char *name)
{

View file

@ -2,3 +2,4 @@
#include <libc.h>
#include <bio.h>
#include <regexp.h>