
work around freebsd 5.4 brokenness (if you don't have IPv6 in the kernel, socket(PF_INET6,SOCK_STREAM,0) returns EPROTONOSUPPORT instead of EPFNOSUPPORT, which basically says "yeah, I know IPv6, but TCP? never heard of it")
13 lines
266 B
C
13 lines
266 B
C
#include "byte.h"
|
|
#include "buffer.h"
|
|
|
|
int buffer_get(buffer* b,char* x,unsigned long int len) {
|
|
int blen;
|
|
if ((blen=buffer_feed(b))<0) return blen;
|
|
if ((unsigned long int) blen>=len)
|
|
blen=len;
|
|
byte_copy(x,blen,b->x+b->p);
|
|
b->p+=blen;
|
|
return blen;
|
|
}
|