* eval.c: Integer and memory overflow fixes.
[bpt/emacs.git] / lib-src / pop.c
index 26a992f..a94e06f 100644 (file)
@@ -1,6 +1,7 @@
 /* pop.c: client routines for talking to a POP3-protocol post-office server
-   Copyright (C) 1991, 1993, 1996, 1997, 1999, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2011
+  Free Software Foundation, Inc.
 
 Author: Jonathan Kamens <jik@security.ov.com>
 
@@ -64,13 +65,8 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
 #include <netdb.h>
 #include <errno.h>
 #include <stdio.h>
-#ifdef STDC_HEADERS
 #include <string.h>
-#define index strchr
-#endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #ifdef KERBEROS
 # ifdef HAVE_KRB5_H
@@ -92,6 +88,8 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
 # endif
 #endif /* KERBEROS */
 
+#include <min-max.h>
+
 #ifdef KERBEROS
 #ifndef KERBEROS5
 extern int krb_sendauth (/* long, int, KTEXT, char *, char *, char *,
@@ -110,7 +108,7 @@ extern int h_errno;
 
 static int socket_connection (char *, int);
 static int pop_getline (popserver, char **);
-static int sendline (popserver, char *);
+static int sendline (popserver, const char *);
 static int fullwrite (int, char *, int);
 static int getok (popserver);
 #if 0
@@ -123,19 +121,15 @@ static char *find_crlf (char *, int);
                                   to be bigger than the original
                                   value of 80 */
 #define POP_PORT 110
-#define KPOP_PORT 1109
 #define POP_SERVICE "pop3"     /* we don't want the POP2 port! */
 #ifdef KERBEROS
+#define KPOP_PORT 1109
 #define KPOP_SERVICE "kpop"    /* never used: look for 20060515 to see why */
 #endif
 
 char pop_error[ERROR_MAX];
 int pop_debug = 0;
 
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
 /*
  * Function: pop_open (char *host, char *username, char *password,
  *                    int flags)
@@ -676,7 +670,7 @@ pop_top_flush (popserver server)
 }
 
 int
-pop_multi_first (popserver server, char *command, char **response)
+pop_multi_first (popserver server, const char *command, char **response)
 {
   if (server->in_multi)
     {
@@ -988,7 +982,7 @@ socket_connection (char *host, int flags)
   struct servent *servent;
   struct sockaddr_in addr;
   char found_port = 0;
-  char *service;
+  const char *service;
   int sock;
   char *realhost;
 #ifdef KERBEROS
@@ -1414,7 +1408,7 @@ pop_getline (popserver server, char **line)
  * Side effects: Closes the connection on error.
  */
 static int
-sendline (popserver server, char *line)
+sendline (popserver server, const char *line)
 {
 #define SENDLINE_ERROR "Error writing to POP server: "
   int ret;
@@ -1626,6 +1620,3 @@ find_crlf (char *in_string, int len)
 }
 
 #endif /* MAIL_USE_POP */
-
-/* arch-tag: ceb37041-b7ad-49a8-a63d-286618b8367d
-   (do not change this comment) */