changeset 15108:442458addd50

(SEND, RECV): Renamed from send, recv. (pop_open, pop_trash): Make the trash_started code unconditional. (socket_connection): Delete casts to void.
author Richard M. Stallman <rms@gnu.org>
date Mon, 29 Apr 1996 15:46:17 +0000
parents e025990722ca
children b801c02f3e92
files lib-src/pop.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/pop.c	Mon Apr 29 15:29:52 1996 +0000
+++ b/lib-src/pop.c	Mon Apr 29 15:46:17 1996 +0000
@@ -41,12 +41,15 @@
 #include "ntlib.h"
 #include <winsock.h>
 #undef SOCKET_ERROR
+#define RECV(s,buf,len,flags) recv(s,buf,len,flags)
+#define SEND(s,buf,len,flags) send(s,buf,len,flags)
+#define CLOSESOCKET(s) closesocket(s)
 #else
 #include <netinet/in.h>
 #include <sys/socket.h>
-#define recv(s,buf,len,flags) read(s,buf,len)
-#define send(s,buf,len,flags) write(s,buf,len)
-#define closesocket close
+#define RECV(s,buf,len,flags) read(s,buf,len)
+#define SEND(s,buf,len,flags) write(s,buf,len)
+#define CLOSESOCKET(s) close(s)
 #endif
 #include <pop.h>
 
@@ -1084,7 +1087,7 @@
      
   if (! *hostent->h_addr_list)
     {
-      (void) closesocket (sock);
+      CLOSESOCKET (sock);
       strcpy (pop_error, CONNECT_ERROR);
       strncat (pop_error, strerror (errno),
 	       ERROR_MAX - sizeof (CONNECT_ERROR));
@@ -1105,7 +1108,7 @@
 	  strcpy (pop_error, KRB_ERROR);
 	  strncat (pop_error, error_message (rem),
 		   ERROR_MAX - sizeof(KRB_ERROR));
-	  (void) closesocket (sock);
+	  CLOSESOCKET (sock);
 	  return (-1);
 	}
 
@@ -1162,7 +1165,7 @@
 	  if (err_ret)
 	    krb5_free_error (err_ret);
 
-	  (void) closesocket (sock);
+	  CLOSESOCKET (sock);
 	  return (-1);
 	}
 #else  /* ! KRB5 */	  
@@ -1179,7 +1182,7 @@
 	  strcpy (pop_error, KRB_ERROR);
 	  strncat (pop_error, krb_err_txt[rem],
 		   ERROR_MAX - sizeof (KRB_ERROR));
-	  (void) closesocket (sock);
+	  CLOSESOCKET (sock);
 	  return (-1);
 	}
 #endif /* KRB5 */
@@ -1271,7 +1274,7 @@
 	      return (0);
 	    }
 	}
-      ret = recv (server->file, server->buffer + server->data,
+      ret = RECV (server->file, server->buffer + server->data,
 		  server->buffer_size - server->data - 1, 0);
       if (ret < 0)
 	{
@@ -1377,7 +1380,7 @@
   int ret;
 
   cp = buf;
-  while ((ret = send (fd, cp, nbytes, 0)) > 0)
+  while ((ret = SEND (fd, cp, nbytes, 0)) > 0)
     {
       cp += ret;
       nbytes -= ret;
@@ -1496,16 +1499,15 @@
 {
   if (server->file >= 0)
     {
-#ifdef WINDOWSNT
       /* avoid recursion; sendline can call pop_trash */
       if (server->trash_started)
 	return;
       server->trash_started = 1;
-#endif
+
       sendline (server, "RSET");
       sendline (server, "QUIT");
 
-      closesocket (server->file);
+      CLOSESOCKET (server->file);
       server->file = -1;
       if (server->buffer)
 	{