#include "mutt_idna.h"
+#include "lib/mem.h"
+#include "lib/intl.h"
+#include "lib/str.h"
+#include "lib/debug.h"
+
#include <unistd.h>
#include <netinet/in.h>
#include <netdb.h>
int rc = -1;
if (conn->fd < 0)
- dprint (1,
- (debugfile,
- "mutt_socket_close: Attempt to close closed connection.\n"));
+ debug_print (1, ("Attempt to close closed connection.\n"));
else
rc = conn->conn_close (conn);
int rc;
if (conn->fd < 0) {
- dprint (1,
- (debugfile,
- "mutt_socket_read: attempt to read from closed connection\n"));
+ debug_print (1, ("attempt to read from closed connection\n"));
return -1;
}
int rc;
int len;
- dprint (dbg, (debugfile, "> %s", buf));
+ debug_print (dbg, ("> %s", buf));
if (conn->fd < 0) {
- dprint (1,
- (debugfile,
- "mutt_socket_write: attempt to write to closed connection\n"));
+ debug_print (1, ("attempt to write to closed connection\n"));
return -1;
}
- len = mutt_strlen (buf);
+ len = safe_strlen (buf);
if ((rc = conn->conn_write (conn, buf, len)) < 0) {
- dprint (1, (debugfile,
- "mutt_socket_write: error writing, closing socket\n"));
+ debug_print (1, ("error writing, closing socket\n"));
mutt_socket_close (conn);
return -1;
}
if (rc < len) {
- dprint (1, (debugfile,
- "mutt_socket_write: ERROR: wrote %d of %d bytes!\n", rc,
- len));
+ debug_print (1, ("ERROR: wrote %d of %d bytes!\n", rc, len));
}
return rc;
conn->available =
conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf));
else {
- dprint (1,
- (debugfile,
- "mutt_socket_readchar: attempt to read from closed connection.\n"));
+ debug_print (1, ("attempt to read from closed connection.\n"));
return -1;
}
conn->bufpos = 0;
else
buf[i] = '\0';
- dprint (dbg, (debugfile, "< %s\n", buf));
+ debug_print (dbg, ("< %s\n", buf));
- /* number of bytes read, not strlen */
+ /* number of bytes read, not safe_strlen */
return i + 1;
}
int rc;
int save_errno;
- if (mutt_strlen (Preconnect)) {
- dprint (2, (debugfile, "Executing preconnect: %s\n", Preconnect));
+ if (safe_strlen (Preconnect)) {
+ debug_print (2, ("Executing preconnect: %s\n", Preconnect));
rc = mutt_system (Preconnect);
- dprint (2, (debugfile, "Preconnect result: %d\n", rc));
+ debug_print (2, ("Preconnect result: %d\n", rc));
if (rc) {
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
sa_size = sizeof (struct sockaddr_in6);
#endif
else {
- dprint (1, (debugfile, "Unknown address family!\n"));
+ debug_print (1, ("Unknown address family!\n"));
return -1;
}
if (connect (fd, sa, sa_size) < 0) {
save_errno = errno;
- dprint (2, (debugfile, "Connection failed. errno: %d...\n", errno));
+ debug_print (2, ("Connection failed. errno: %d...\n", errno));
SigInt = 0; /* reset in case we caught SIGINTR while in connect() */
}