mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
add readn to avoid need for plan9port libc
This commit is contained in:
parent
93f2ae0d92
commit
2b9172c7d4
2 changed files with 20 additions and 0 deletions
|
@ -22,6 +22,25 @@ static int dolong = 1;
|
||||||
static void atimes(char *);
|
static void atimes(char *);
|
||||||
static char *split(char*, 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
|
long
|
||||||
atimeof(int force, char *name)
|
atimeof(int force, char *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <regexp.h>
|
#include <regexp.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue