aboutsummaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-10-02 12:07:02 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-10-02 12:07:02 +0000
commited38631c6bd2f020d7dfd05be36d1dc4383ac643 (patch)
treedffa1087ded9e8133cab3a30e7900af437c1a7f5 /socket.c
parent2f077aec530acecd7876a562ac787f38c0f47116 (diff)
downloadfetchmail-ed38631c6bd2f020d7dfd05be36d1dc4383ac643.tar.gz
fetchmail-ed38631c6bd2f020d7dfd05be36d1dc4383ac643.tar.bz2
fetchmail-ed38631c6bd2f020d7dfd05be36d1dc4383ac643.zip
Anticipate the IDLE extension.
svn path=/trunk/; revision=2630
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/socket.c b/socket.c
index c0925723..058fe2d5 100644
--- a/socket.c
+++ b/socket.c
@@ -92,6 +92,31 @@ static int handle_plugin(const char *host,
}
#endif /* HAVE_SOCKETPAIR */
+#ifdef __UNUSED__
+#include <sys/time.h>
+
+int SockCheckOpen(int fd)
+/* poll given socket; is it selectable? */
+{
+ fd_set r, w, e;
+ int rt;
+ struct timeval tv;
+
+ for (;;)
+ {
+ FD_ZERO(&r); FD_ZERO(&w); FD_ZERO(&e);
+ FD_SET(fd, &e);
+
+ tv.tv_sec = 0; tv.tv_usec = 0;
+ rt = select(fd+1, &r, &w, &e, &tv);
+ if (rt == -1 && (errno != EAGAIN && errno != EINTR))
+ return 0;
+ if (rt != -1)
+ return 1;
+ }
+}
+#endif /* __UNUSED__ */
+
#if INET6
int SockOpen(const char *host, const char *service, const char *options,
const char *plugin)
@@ -148,7 +173,7 @@ int SockOpen(const char *host, const char *service, const char *options,
int SockOpen(const char *host, int clientPort, const char *options,
const char *plugin)
{
- int sock;
+ int sock = -1; /* pacify -Wall */
#ifndef HAVE_INET_ATON
unsigned long inaddr;
#endif /* HAVE_INET_ATON */