X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lib-src%2Fpop.c;h=79160ebc6d0466dab279195591d19d19cfb6a09d;hp=728d1cae33747726cacaf2e5c9f3d12e686a3db2;hb=14144012929ab5944f367d5d1b323ab8268abb05;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910 diff --git a/lib-src/pop.c b/lib-src/pop.c index 728d1ca..79160eb 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -21,24 +21,16 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #define NO_SHORTNAMES /* Tell config not to load remap.h */ -#include <../src/config.h> +#define DONT_ENCAPSULATE +#include #else #define MAIL_USE_POP #endif #ifdef MAIL_USE_POP -#ifdef HAVE_CONFIG_H -/* Cancel these substitutions made in config.h */ -#undef open -#undef read -#undef write -#undef close -#endif - #include -#ifdef WINDOWSNT -#include "ntlib.h" +#ifdef WIN32_NATIVE #include #undef SOCKET_ERROR #define RECV(s,buf,len,flags) recv(s,buf,len,flags) @@ -68,16 +60,24 @@ Boston, MA 02111-1307, USA. */ extern struct servent *hes_getservbyname (/* char *, char * */); #endif -#include +#include "../src/syspwd.h" +#ifndef WIN32_NATIVE #include +#endif #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include +#ifndef WIN32_NATIVE #include +#endif #include "../src/syswait.h" +#ifndef WIN32_NATIVE #include "../src/systime.h" +#endif #include #include @@ -102,7 +102,7 @@ extern char *krb_realmofhost (/* char * */); #endif /* ! KRB5 */ #endif /* KERBEROS */ -#ifndef WINDOWSNT +#ifndef WIN32_NATIVE #if !defined(HAVE_H_ERRNO) || !defined(HAVE_CONFIG_H) extern int h_errno; #endif @@ -122,7 +122,7 @@ static char *find_crlf (char *); #define ERROR_MAX 80 /* a pretty arbitrary size */ #define POP_PORT 110 #define KPOP_PORT 1109 -#if defined(WINDOWSNT) || defined(__CYGWIN32__) +#if defined(WIN32_NATIVE) || defined(CYGWIN) #define POP_SERVICE "pop3" /* we don't want the POP2 port! */ #else #define POP_SERVICE "pop" @@ -183,6 +183,7 @@ pop_open (char *host, char *username, char *password, int flags) username = getenv ("USER"); if (! (username && *username)) { +#ifndef WIN32_NATIVE username = getlogin (); if (! (username && *username)) { @@ -198,6 +199,10 @@ pop_open (char *host, char *username, char *password, int flags) return (0); } } +#else + strcpy (pop_error, "Could not determine username"); + return (0); +#endif } } @@ -247,10 +252,12 @@ pop_open (char *host, char *username, char *password, int flags) if ((! password) && (! DONT_NEED_PASSWORD)) { +#ifndef WIN32_NATIVE if (! (flags & POP_NO_GETPASS)) { password = getpass ("Enter POP password:"); } +#endif if (! password) { strcpy (pop_error, "Could not determine POP password"); @@ -914,7 +921,7 @@ pop_quit (popserver server) ret = -1; } - close (server->file); + CLOSESOCKET (server->file); } if (server->buffer) @@ -924,7 +931,7 @@ pop_quit (popserver server) return (ret); } -#ifdef WINDOWSNT +#ifdef WIN32_NATIVE static int have_winsock = 0; #endif @@ -969,7 +976,7 @@ socket_connection (char *host, int flags) int try_count = 0; -#ifdef WINDOWSNT +#ifdef WIN32_NATIVE { WSADATA winsockData; if (WSAStartup (0x101, &winsockData) == 0) @@ -1474,7 +1481,7 @@ pop_trash (popserver server) } } -#ifdef WINDOWSNT +#ifdef WIN32_NATIVE if (have_winsock) WSACleanup (); #endif