Commit 442711bc 442711bcda49eeca667d15c509d200995379c832 by Sergey Poznyakoff

Use MU_CTYPE_ENDLN to trim \r\n.

1 parent 0cb608de
......@@ -319,7 +319,7 @@ io_getline (char **pbuf, size_t *psize, size_t *pnbytes)
imap4d_bye (ERR_NO_IFILE);
/*FIXME rc = ECONNABORTED;*/
}
len = mu_rtrim_cset (s, "\r\n");
len = mu_rtrim_class (s, MU_CTYPE_ENDLN);
if (pnbytes)
*pnbytes = len;
}
......
......@@ -463,7 +463,7 @@ do_preauth_program (struct sockaddr *pcs, struct sockaddr *sa)
}
else
{
mu_rtrim_cset (buf, "\r\n");
mu_rtrim_class (buf, MU_CTYPE_ENDLN);
return buf;
}
return NULL;
......
......@@ -248,7 +248,7 @@ spamd_read_line (mu_sieve_machine_t mach, mu_stream_t stream,
size_t n;
int rc = mu_stream_getline (stream, pbuffer, psize, &n);
if (rc == 0)
mu_rtrim_cset (*pbuffer, "\r\n");
mu_rtrim_class (*pbuffer, MU_CTYPE_ENDLN);
else
{
/* FIXME: Need an 'onabort' mechanism in Sieve machine, which
......
......@@ -68,7 +68,7 @@ mu_smtp_response (mu_smtp_t smtp)
MU_SMTP_CHECK_ERROR (smtp, rc);
if (n == 0)
MU_SMTP_CHECK_ERROR (smtp, EIO);
n = mu_rtrim_cset (smtp->rdbuf, "\r\n");
n = mu_rtrim_class (smtp->rdbuf, MU_CTYPE_ENDLN);
if (n < 3 || !mu_isdigit (smtp->rdbuf[0]))
{
mu_diag_output (MU_DIAG_NOTICE,
......@@ -101,7 +101,7 @@ mu_smtp_response (mu_smtp_t smtp)
MU_SMTP_CHECK_ERROR (smtp, rc);
if (n == 0)
MU_SMTP_CHECK_ERROR (smtp, EIO);
n = mu_rtrim_cset (smtp->rdbuf, "\r\n");
n = mu_rtrim_class (smtp->rdbuf, MU_CTYPE_ENDLN);
if (n < 3 || memcmp (smtp->rdbuf, smtp->replcode, 3))
{
mu_diag_output (MU_DIAG_NOTICE,
......
......@@ -28,6 +28,7 @@
#include <mailutils/cstr.h>
#include <mailutils/io.h>
#include <mailutils/filter.h>
#include <mailutils/cctype.h>
#define ATTRIBUTE_IS_DELETED(flag) (flag & MU_ATTRIBUTE_DELETED)
#define ATTRIBUTE_IS_EQUAL(flag1, flag2) (flag1 == flag2)
......@@ -381,7 +382,7 @@ mbox_envelope_date (mu_envelope_t envelope, char *buf, size_t len,
&n);
if (status)
return status;
mu_rtrim_cset (buffer, "\r\n");
mu_rtrim_class (buffer, MU_CTYPE_ENDLN);
/* Format: "From [sender] [date]" */
/* strlen ("From ") == 5 */
......@@ -938,7 +939,7 @@ msg_envelope_to_stream (mu_stream_t out, mu_message_t msg)
return status;
}
mu_rtrim_cset (datestr, "\r\n");
mu_rtrim_class (datestr, MU_CTYPE_ENDLN);
envarr[0] = "From ";
envarr[1] = sender;
......
......@@ -640,7 +640,7 @@ pop_header_blurb (mu_stream_t stream, size_t maxlines,
while ((status = mu_stream_getline (stream, &buf, &size, &n)) == 0 && n > 0)
{
size_t len = mu_rtrim_cset (buf, "\r\n");
size_t len = mu_rtrim_class (buf, MU_CTYPE_ENDLN);
if (len == 0)
break;
mu_opool_append (opool, buf, len);
......
......@@ -545,7 +545,7 @@ lmtp_loop (mu_stream_t iostr, unsigned int timeout)
enum lmtp_command cmd = cp->cmd_code;
enum lmtp_state next_state = transtab[cmd][state];
mu_rtrim_cset (sp, "\r\n");
mu_rtrim_class (sp, MU_CTYPE_ENDLN);
if (next_state != state_none)
{
......