-#if defined(HAVE_GLIBC_STDIO)
-static cookie_io_functions_t iofuns = {
- .read = mtread,
- .write = mtwrite,
- .close = mtclose,
-};
-
-FILE *mtstdopen(int fd, int issock, int timeout, char *mode)
-{
- struct stdiofd *d;
- FILE *ret;
-
- omalloc(d);
- d->fd = fd;
- d->sock = issock;
- d->timeout = timeout;
- ret = fopencookie(d, mode, iofuns);
- if(!ret)
- free(d);
- else
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
- return(ret);
-}
-#elif defined(HAVE_BSD_STDIO)
-static int bsd2mtread(void *cookie, char *buf, int len)
-{
- return(mtread(cookie, buf, len));
-}
-
-static int bsd2mtwrite(void *cookie, const char *buf, int len)
-{
- return(mtwrite(cookie, buf, len));
-}
-