]> code.delx.au - gnu-emacs/blobdiff - lib-src/pop.c
Rework C source files to avoid ^(
[gnu-emacs] / lib-src / pop.c
index a269144c9156d2a8d009ef3a4d8ec010f9294678..6e3b6a9a7735591147e417600e6b00f77b8ffd25 100644 (file)
@@ -1,6 +1,6 @@
 /* pop.c: client routines for talking to a POP3-protocol post-office server
 
-Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2013 Free Software
+Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2016 Free Software
 Foundation, Inc.
 
 Author: Jonathan Kamens <jik@security.ov.com>
@@ -9,8 +9,8 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -42,10 +42,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #include <pop.h>
 
-#ifdef sun
-#include <malloc.h>
-#endif /* sun */
-
 #ifdef HESIOD
 #include <hesiod.h>
 /*
@@ -124,7 +120,7 @@ static char *find_crlf (char *, int);
 #endif
 
 char pop_error[ERROR_MAX];
-int pop_debug = 0;
+bool pop_debug = false;
 
 /*
  * Function: pop_open (char *host, char *username, char *password,
@@ -269,8 +265,8 @@ pop_open (char *host, char *username, char *password, int flags)
   server->data = 0;
   server->buffer_index = 0;
   server->buffer_size = GETLINE_MIN;
-  server->in_multi = 0;
-  server->trash_started = 0;
+  server->in_multi = false;
+  server->trash_started = false;
 
   if (getok (server))
     return (0);
@@ -686,7 +682,7 @@ pop_multi_first (popserver server, const char *command, char **response)
   else if (0 == strncmp (*response, "+OK", 3))
     {
       for (*response += 3; **response == ' '; (*response)++) /* empty */;
-      server->in_multi = 1;
+      server->in_multi = true;
       return (0);
     }
   else
@@ -728,7 +724,7 @@ pop_multi_next (popserver server, char **line)
       if (! fromserver[1])
        {
          *line = 0;
-         server->in_multi = 0;
+         server->in_multi = false;
          return (0);
        }
       else
@@ -1188,7 +1184,7 @@ socket_connection (char *host, int flags)
            {
              int errlen = err_ret->text.length;
              snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
-                       " [server says '.*%s']", errlen, err_ret->text.data);
+                       " [server says '%.*s']", errlen, err_ret->text.data);
            }
 #elif defined HAVE_KRB5_ERROR_E_TEXT
          if (err_ret && err_ret->e_text && **err_ret->e_text)
@@ -1397,8 +1393,7 @@ sendline (popserver server, const char *line)
      over a few dozen messages, and is a big chunk of the time we
      spend fetching mail from a server close by.  */
   buf = alloca (strlen (line) + 3);
-  strcpy (buf, line);
-  strcat (buf, "\r\n");
+  strcpy (stpcpy (buf, line), "\r\n");
   ret = fullwrite (server->file, buf, strlen (buf));
 
   if (ret < 0)
@@ -1546,7 +1541,7 @@ pop_trash (popserver server)
       /* avoid recursion; sendline can call pop_trash */
       if (server->trash_started)
        return;
-      server->trash_started = 1;
+      server->trash_started = true;
 
       sendline (server, "RSET");
       sendline (server, "QUIT");