diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2000-04-08 06:59:47 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2000-04-08 06:59:47 +0000 |
commit | 2065c80c50dcd792d299ec7b4ab4887e1cb67768 (patch) | |
tree | b3dba7aeb673cbd762d620740aec69b727b21e20 | |
parent | 8b999451bf2396e11fc2ff9560e2dc8ef127bfd6 (diff) | |
download | fetchmail-2065c80c50dcd792d299ec7b4ab4887e1cb67768.tar.gz fetchmail-2065c80c50dcd792d299ec7b4ab4887e1cb67768.tar.bz2 fetchmail-2065c80c50dcd792d299ec7b4ab4887e1cb67768.zip |
BeOS support.
svn path=/trunk/; revision=2866
-rw-r--r-- | Makefile.in | 5 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | checkalias.c | 12 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | driver.c | 8 | ||||
-rw-r--r-- | env.c | 3 | ||||
-rw-r--r-- | etrn.c | 3 | ||||
-rw-r--r-- | fetchmail-features.html | 7 | ||||
-rw-r--r-- | fetchmail.c | 5 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | getpass.c | 2 | ||||
-rw-r--r-- | mxget.c | 13 | ||||
-rw-r--r-- | rcfile_y.y | 2 | ||||
-rw-r--r-- | socket.c | 79 |
15 files changed, 118 insertions, 35 deletions
diff --git a/Makefile.in b/Makefile.in index ab6b373f..29a1c86c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,7 +4,7 @@ # So just uncomment all the lines marked QNX. PACKAGE = fetchmail -VERSION = 5.3.5 +VERSION = 5.3.6 SUBDIRS = @INTLSUB@ @POSUB@ @@ -250,7 +250,8 @@ scripts = $(srcdir)/install.sh $(srcdir)/mkinstalldirs \ $(srcdir)/specgen.sh $(srcdir)/lsmgen.sh $(srcdir)/fetchmailconf all = $(docs) $(config) $(srcs) $(parser) $(headers) $(extra) $(scripts) \ $(srcdir)/rh-config/* $(srcdir)/debian/* $(srcdir)/contrib/*[A-Za-uw-z] \ - $(srcdir)/intl/* $(srcdir)/po/* ABOUT-NLS $(srcdir)/MANIFEST + $(srcdir)/intl/* $(srcdir)/po/* $(srcdir)/beos/* ABOUT-NLS \ + $(srcdir)/MANIFEST MANIFEST: $(srcdir) Makefile.in @echo $(all) | tr "[ \t]" '\n' | sed -e '/^\.\//s///' | sort >MANIFEST @@ -12,6 +12,7 @@ * French internationalization update from Guy Brand. * IMAP PREAUTH fix from Todd Sabin <tas@webspan.net>. * Uwe Girlich's lexical fix for dealing with all-numeric usernames. +* Fetchmail now runs on BeOS, thanks to David Reid <david@jetnet.co.uk>. fetchmail-5.3.5 (Wed Mar 29 18:17:19 EST 2000), 18840 lines: @@ -19,12 +19,10 @@ extensively tested under the BSD variants, AIX, HP-UX versions 9 and 10, SunOS, Solaris, NEXTSTEP, OSF 3.2, IRIX, and Rhapsody. It should be readily portable to other Unix variants (it uses GNU -autoconf). It has been ported to LynxOS and will build there without -special action. It has also been ported to QNX; to build under QNX, -see the header comments in the Makefile. It is reported to build and -run under AmigaOS. - -Fetchmail is Y2K safe. +autoconf). It has been ported to LynxOS and BeOS and will build there +without special action. It has also been ported to QNX; to build +under QNX, see the header comments in the Makefile. It is reported to +build and run under AmigaOS. See the distribution files FEATURES for a full list of features, NEWS for detailed information on recent changes, NOTES for design notes, and diff --git a/checkalias.c b/checkalias.c index 28d7861f..5b8b6744 100644 --- a/checkalias.c +++ b/checkalias.c @@ -10,9 +10,15 @@ #include <stdio.h> #include <string.h> #include <sys/types.h> +#ifdef HAVE_NET_SOCKET_H +#include <net/socket.h> +#else #include <sys/socket.h> +#endif #include <netinet/in.h> +#ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> +#endif #include <netdb.h> #include "i18n.h" #include "mx.h" @@ -180,9 +186,10 @@ int is_host_alias(const char *name, struct query *ctl) switch (h_errno) { case HOST_NOT_FOUND: /* specified host is unknown */ +#ifndef __BEOS__ case NO_ADDRESS: /* valid, but does not have an IP address */ break; - +#endif case NO_RECOVERY: /* non-recoverable name server error */ case TRY_AGAIN: /* temporary error on authoritative server */ default: @@ -206,10 +213,11 @@ int is_host_alias(const char *name, struct query *ctl) switch (h_errno) { case HOST_NOT_FOUND: /* specified host is unknown */ +#ifndef __BEOS__ case NO_ADDRESS: /* valid, but does not have an IP address */ return(FALSE); break; - +#endif case NO_RECOVERY: /* non-recoverable name server error */ case TRY_AGAIN: /* temporary error on authoritative server */ default: diff --git a/configure.in b/configure.in index cec89b54..134e43dc 100644 --- a/configure.in +++ b/configure.in @@ -24,6 +24,7 @@ AC_TYPE_SIZE_T AC_TYPE_PID_T AC_TYPE_SIGNAL AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h stdarg.h alloca.h sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h) +AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h resolv.h net/socket.h) AC_C_CONST dnl getopt needs this. @@ -31,6 +31,10 @@ #include <sys/time.h> #include <signal.h> +#ifdef HAVE_NET_SOCKET_H +#include <net/socket.h> +#endif + #ifdef HAVE_RES_SEARCH #include <netdb.h> #include "mx.h" @@ -98,7 +102,7 @@ static int msglen; /* actual message length */ void set_timeout(int timeleft) /* reset the nonresponse-timeout */ { -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__BEOS__) struct itimerval ntimeout; if (timeleft == 0) @@ -1612,8 +1616,10 @@ const int maxfetch; /* maximum number of messages to fetch */ { if (h_errno == HOST_NOT_FOUND) strcpy(errbuf, _("host is unknown.")); +#ifndef __BEOS__ else if (h_errno == NO_ADDRESS) strcpy(errbuf, _("name is valid but has no IP address.")); +#endif else if (h_errno == NO_RECOVERY) strcpy(errbuf, _("unrecoverable name server error.")); else if (h_errno == TRY_AGAIN) @@ -16,6 +16,9 @@ #endif #include <pwd.h> #include <string.h> +#ifdef HAVE_NET_SOCKET_H +#include <net/socket.h> +#endif #ifdef HAVE_GETHOSTBYNAME #include <netdb.h> #endif /* HAVE_GETHOSTBYNAME */ @@ -9,6 +9,9 @@ #include <stdio.h> #include <stdlib.h> #include <assert.h> +#ifdef HAVE_NET_SOCKET_H /* BeOS needs this */ +#include <net/socket.h> +#endif #include <netdb.h> #include <errno.h> #include <unistd.h> diff --git a/fetchmail-features.html b/fetchmail-features.html index f9082515..794f3c18 100644 --- a/fetchmail-features.html +++ b/fetchmail-features.html @@ -10,7 +10,7 @@ <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> -<td width="30%" align=right>$Date: 2000/04/07 10:07:05 $ +<td width="30%" align=right>$Date: 2000/04/08 06:59:44 $ </table> <HR> @@ -19,6 +19,9 @@ <H2>Since 5.0:</H2> <UL> <LI> +Fetchmail now runs on BeOS, thanks to David Reid" <david@jetnet.co.uk>. + +<LI> In IMAP, unseen-message counting and indexing is now done by SEARCH UNSEEN at the beginning of each poll or re-poll (rather than with the UNSEEN and RECENT responses and FLAGS queries on individual @@ -208,7 +211,7 @@ get-mail, gwpop, pimp-1.0, pop-perl5-1.2, popc, popmail-1.6 and upop.<P> <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> -<td width="30%" align=right>$Date: 2000/04/07 10:07:05 $ +<td width="30%" align=right>$Date: 2000/04/08 06:59:44 $ </table> <P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com"><esr@snark.thyrsus.com></A></ADDRESS> diff --git a/fetchmail.c b/fetchmail.c index f9db4261..f7428211 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -31,6 +31,9 @@ #endif /* HAVE_SETRLIMIT */ #include <sys/utsname.h> +#ifdef HAVE_NET_SOCKET_H +#include <net/socket.h> +#endif #ifdef HAVE_GETHOSTBYNAME #include <netdb.h> #endif /* HAVE_GETHOSTBYNAME */ @@ -492,7 +495,7 @@ int main(int argc, char **argv) strlen(ctl->server.pollname) + 1); (void) sprintf(tmpbuf, password_prompt, ctl->remotename, ctl->server.pollname); - ctl->password = xstrdup((char *)getpassword(tmpbuf)); + ctl->password = xstrdup((char *)fm_getpassword(tmpbuf)); } } diff --git a/fetchmail.h b/fetchmail.h index cca85409..48e2dc63 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -507,7 +507,7 @@ int parsecmdline (int, char **, struct runctl *, struct query *); char *MD5Digest (unsigned char *); int POP3_auth_rpa(unsigned char *, unsigned char *, int socket); int daemonize(const char *, void (*)(int)); -char *getpassword(char *); +char *fm_getpassword(char *); void escapes(const char *, char *); char *visbuf(const char *); const char *showproto(int); @@ -60,7 +60,7 @@ void static disable_tty_echo(void); void static restore_tty_state(void); static RETSIGTYPE sigint_handler(int); -char *getpassword(prompt) +char *fm_getpassword(prompt) char *prompt; { #if !(defined(HAVE_TCSETATTR) || defined(HAVE_TERMIO_H) || defined(HAVE_STTY)) @@ -9,11 +9,24 @@ #ifdef HAVE_RES_SEARCH #include <stdio.h> #include <string.h> +#ifdef HAVE_NET_SOCKET_H +#include <net/socket.h> +#endif #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> + +#ifdef __BEOS__ +#include "beos/beos_nameser.h" +#endif + +#ifdef HAVE_ARPA_NAMESER_H #include <arpa/nameser.h> +#endif +#ifdef HAVE_RESOLV_H #include <resolv.h> +#endif + #include "mx.h" /* @@ -405,12 +405,14 @@ int prc_filecheck(const char *pathname, const flag securecheck) return(PS_IOERR); } +#ifndef __BEOS__ if (statbuf.st_mode & ~(S_IFREG | S_IREAD | S_IWRITE | S_IEXEC | S_IXGRP)) { fprintf(stderr, "File %s must have no more than -rwx--x--- (0710) permissions.\n", pathname); return(PS_IOERR); } +#endif /* __BEOS__ */ #ifdef HAVE_GETEUID if (statbuf.st_uid != geteuid()) @@ -13,9 +13,15 @@ #include <memory.h> #endif /* HAVE_MEMORY_H */ #include <sys/types.h> +#ifndef HAVE_NET_SOCKET_H #include <sys/socket.h> +#else +#include <net/socket.h> +#endif #include <netinet/in.h> +#ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> +#endif #include <netdb.h> #if defined(STDC_HEADERS) #include <stdlib.h> @@ -32,6 +38,20 @@ #include "fetchmail.h" #include "i18n.h" +/* Defines to allow BeOS to play nice... */ +#ifdef __BEOS__ +static char peeked; +#define fm_close(a) closesocket(a) +#define fm_write(a,b,c) send(a,b,c,0) +#define fm_peek(a,b,c) recv(a,b,c,0) +#define fm_read(a,b,c) recv(a,b,c,0) +#else +#define fm_close(a) close(a) +#define fm_write(a,b,c) write(a,b,c) +#define fm_peek(a,b,c) recv(a,b,c, MSG_PEEK) +#define fm_read(a,b,c) read(a,b,c) +#endif + /* We need to define h_errno only if it is not already */ #ifndef h_errno @@ -164,7 +184,7 @@ int SockOpen(const char *host, const char *service, const char *options, if (i < 0) continue; if (connect(i, (struct sockaddr *) ai->ai_addr, ai->ai_addrlen) < 0) { - close(i); + fm_close(i); i = -1; continue; } @@ -230,7 +250,7 @@ int SockOpen(const char *host, int clientPort, const char *options, if (connect(sock, (struct sockaddr *) &ad, sizeof(ad)) < 0) { int olderr = errno; - close(sock); /* don't use SockClose, no traffic yet */ + fm_close(sock); /* don't use SockClose, no traffic yet */ h_errno = 0; errno = olderr; return -1; @@ -276,19 +296,20 @@ int SockOpen(const char *host, int clientPort, const char *options, memcpy(&ad.sin_addr, *pptr, sizeof(struct in_addr)); if (connect(sock, (struct sockaddr *) &ad, sizeof(ad)) == 0) break; /* success */ - close(sock); /* don't use SockClose, no traffic yet */ + fm_close(sock); /* don't use SockClose, no traffic yet */ memset(&ad, 0, sizeof(ad)); ad.sin_family = AF_INET; } if(*pptr == NULL) { int olderr = errno; - close(sock); /* don't use SockClose, no traffic yet */ + fm_close(sock); /* don't use SockClose, no traffic yet */ h_errno = 0; errno = olderr; return -1; } } + return(sock); } #endif /* INET6_ENABLE */ @@ -347,9 +368,9 @@ int SockWrite(int sock, char *buf, int len) if( NULL != ( ssl = SSLGetContext( sock ) ) ) n = SSL_write(ssl, buf, len); else - n = write(sock, buf, len); + n = fm_write(sock, buf, len); #else - n = write(sock, buf, len); + n = fm_write(sock, buf, len); #endif if (n <= 0) return -1; @@ -370,6 +391,14 @@ int SockRead(int sock, char *buf, int len) if (--len < 1) return(-1); +#ifdef __BEOS__ + if (peeked != 0){ + (*bp) = peeked; + bp++; + len--; + peeked = 0; + } +#endif do { /* * The reason for these gymnastics is that we want two things: @@ -422,20 +451,27 @@ int SockRead(int sock, char *buf, int len) newline = bp; } } else { - if ((n = recv(sock, bp, len, MSG_PEEK)) <= 0) + if ((n = fm_peek(sock, bp, len)) <= 0) return(-1); if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; - if ((n = read(sock, bp, n)) == -1) + if ((n = fm_read(sock, bp, n)) == -1) return(-1); } #else - if ((n = recv(sock, bp, len, MSG_PEEK)) <= 0) - return(-1); + +#ifdef __BEOS__ + if ((n = fm_read(sock, bp, 1)) <= 0) +#else + if ((n = fm_peek(sock, bp, len)) <= 0) +#endif + return (-1); if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; - if ((n = read(sock, bp, n)) == -1) +#ifndef __BEOS__ + if ((n = fm_read(sock, bp, n)) == -1) return(-1); +#endif /* __BEOS__ */ #endif bp += n; len -= n; @@ -479,15 +515,20 @@ int SockPeek(int sock) return 0; /* Give him a '\0' character */ } } else { - n = recv(sock, &ch, 1, MSG_PEEK); + n = fm_peek(sock, &ch, 1); } #else - n = recv(sock, &ch, 1, MSG_PEEK); -#endif + + n = fm_peek(sock, &ch, 1); + +#endif /* SSL_ENABLE */ if (n == -1) return -1; - else - return(ch); + +#ifdef __BEOS__ + peeked = ch; +#endif + return(ch); } #ifdef SSL_ENABLE @@ -679,12 +720,12 @@ int SockClose(int sock) * or any error occurs. This makes sure all data sent by the other * side is acknowledged at the TCP level. */ - if (recv(sock, &ch, 1, MSG_PEEK) > 0) - while (read(sock, &ch, 1) > 0) + if (fm_peek(sock, &ch, 1) > 0) + while (fm_read(sock, &ch, 1) > 0) continue; /* if there's an error closing at this point, not much we can do */ - return(close(sock)); /* this is guarded */ + return(fm_close(sock)); /* this is guarded */ } #ifdef MAIN |