Blob
1 #include <u.h>2 #include <libc.h>3 #include <auth.h>4 #include <fcall.h>5 #include <thread.h>6 #include "9p.h"8 void9 readbuf(Req *r, void *s, long n)10 {11 r->ofcall.count = r->ifcall.count;12 if(r->ifcall.offset >= n){13 r->ofcall.count = 0;14 return;15 }16 if(r->ifcall.offset+r->ofcall.count > n)17 r->ofcall.count = n - r->ifcall.offset;18 memmove(r->ofcall.data, (char*)s+r->ifcall.offset, r->ofcall.count);19 }21 void22 readstr(Req *r, char *s)23 {24 if(s == nil)25 r->ofcall.count = 0;26 else27 readbuf(r, s, strlen(s));28 }