summaryrefslogtreecommitdiff
path: root/lib-src/pop.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-10-18 07:34:59 +0000
committerRichard M. Stallman <rms@gnu.org>1994-10-18 07:34:59 +0000
commit5e259bec4742d7d7383d5b6112942e0fcae2ff96 (patch)
treeb077b7b092e2dc5fa8507a372922647e4ba009fe /lib-src/pop.c
parentf231f448520b3c687ebe4e5f2e58c56ab3beb6c3 (diff)
downloademacs-5e259bec4742d7d7383d5b6112942e0fcae2ff96.tar.gz
Don't declare malloc, realloc, free.
Don't include string.h or strings.h. Include des.h before krb.h. Do declare my_strstr. (getline): Really use my_strstr. Leave one empty place in server->buffer, and put a null at the end of the data in it.
Diffstat (limited to 'lib-src/pop.c')
-rw-r--r--lib-src/pop.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 9f5b5476f50..725a9d87cd0 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -26,10 +26,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <pop.h>
#ifdef sun
#include <malloc.h>
-#else
-extern char *malloc (/* unsigned */);
-extern char *realloc (/* char *, unsigned */);
-extern void free (/* char * */);
#endif
#endif
#ifdef HESIOD
@@ -43,15 +39,13 @@ extern void free (/* char * */);
extern struct servent *hes_getservbyname (/* char *, char * */);
#endif
#include <pwd.h>
-#include <string.h>
-#include <strings.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
#ifdef KERBEROS
#ifndef KRB5
-#include <krb.h>
#include <des.h>
+#include <krb.h>
#else /* KRB5 */
#include <krb5/krb5.h>
#include <krb5/ext-proto.h>
@@ -85,6 +79,8 @@ static int gettermination (/* popserver */);
#endif
static void pop_trash (/* popserver */);
+static char *my_strstr ();
+
#define ERROR_MAX 80 /* a pretty arbitrary size */
#define POP_PORT 110
#define KPOP_PORT 1109
@@ -1171,7 +1167,7 @@ getline (server)
if (server->data)
{
- char *cp = strstr (server->buffer + server->buffer_index, "\r\n");
+ char *cp = my_strstr (server->buffer + server->buffer_index, "\r\n");
if (cp)
{
int found;
@@ -1214,7 +1210,7 @@ getline (server)
}
}
ret = read (server->file, server->buffer + server->data,
- server->buffer_size - server->data);
+ server->buffer_size - server->data - 1);
if (ret < 0)
{
strcpy (pop_error, GETLINE_ERROR);
@@ -1231,9 +1227,11 @@ getline (server)
}
else
{
- char *cp = strstr (server->buffer, "\r\n");
+ char *cp;
server->data += ret;
+ server->buffer[server->data] = '\0';
+ cp = my_strstr (server->buffer, "\r\n");
if (cp)
{
int data_used = (cp + 2) - server->buffer;