31 static FILE *_send, *_recv;
35 static ssize_t readn(
int fd,
void *
buf,
size_t count)
39 while (total < count) {
40 ssize_t
n = read(fd, (
char *)buf + total, count - total);
52 static ssize_t writen(
int fd,
const void *
buf,
size_t count)
56 while (total < count) {
57 ssize_t
n = write(fd, (
const char *)buf + total, count - total);
80 return fwrite(buf, 1, size, _send) ==
size;
82 return writen(fileno(_send), buf, size) ==
size;
84 return write(fileno(_send), buf, size) ==
size;
91 #ifdef USE_BUFFERED_IO
94 return fread(buf, 1, size, _recv) ==
size;
96 return readn(fileno(_recv), buf, size) ==
size;
98 return read(fileno(_recv), buf, size) ==
size;
void db__set_protocol_fds(FILE *send, FILE *recv)
int db__send(const void *buf, size_t size)
int db__recv(void *buf, size_t size)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]