tutil.c - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
tutil.c (491B)
---
1 #include <u.h>
2 #include <libc.h>
3 #include <fcall.h>
4 #include <thread.h>
5 #include "9p.h"
6
7 void
8 readbuf(Req *r, void *s, long n)
9 {
10 r->ofcall.count = r->ifcall.count;
11 if(r->ifcall.offset >= n){
12 r->ofcall.count = 0;
13 return;
14 }
15 if(r->ifcall.offset+r->ofcall.count > n)
16 r->ofcall.count = n - r->ifcall.offset;
17 memmove(r->ofcall.data, (char*)s+r->ifcall.offset, r->ofcall.count);
18 }
19
20 void
21 readstr(Req *r, char *s)
22 {
23 if(s == nil)
24 r->ofcall.count = 0;
25 else
26 readbuf(r, s, strlen(s));
27 }