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) ...@@ -319,7 +319,7 @@ io_getline (char **pbuf, size_t *psize, size_t *pnbytes)
319 imap4d_bye (ERR_NO_IFILE); 319 imap4d_bye (ERR_NO_IFILE);
320 /*FIXME rc = ECONNABORTED;*/ 320 /*FIXME rc = ECONNABORTED;*/
321 } 321 }
322 len = mu_rtrim_cset (s, "\r\n"); 322 len = mu_rtrim_class (s, MU_CTYPE_ENDLN);
323 if (pnbytes) 323 if (pnbytes)
324 *pnbytes = len; 324 *pnbytes = len;
325 } 325 }
......
...@@ -463,7 +463,7 @@ do_preauth_program (struct sockaddr *pcs, struct sockaddr *sa) ...@@ -463,7 +463,7 @@ do_preauth_program (struct sockaddr *pcs, struct sockaddr *sa)
463 } 463 }
464 else 464 else
465 { 465 {
466 mu_rtrim_cset (buf, "\r\n"); 466 mu_rtrim_class (buf, MU_CTYPE_ENDLN);
467 return buf; 467 return buf;
468 } 468 }
469 return NULL; 469 return NULL;
......
...@@ -248,7 +248,7 @@ spamd_read_line (mu_sieve_machine_t mach, mu_stream_t stream, ...@@ -248,7 +248,7 @@ spamd_read_line (mu_sieve_machine_t mach, mu_stream_t stream,
248 size_t n; 248 size_t n;
249 int rc = mu_stream_getline (stream, pbuffer, psize, &n); 249 int rc = mu_stream_getline (stream, pbuffer, psize, &n);
250 if (rc == 0) 250 if (rc == 0)
251 mu_rtrim_cset (*pbuffer, "\r\n"); 251 mu_rtrim_class (*pbuffer, MU_CTYPE_ENDLN);
252 else 252 else
253 { 253 {
254 /* FIXME: Need an 'onabort' mechanism in Sieve machine, which 254 /* FIXME: Need an 'onabort' mechanism in Sieve machine, which
......
...@@ -68,7 +68,7 @@ mu_smtp_response (mu_smtp_t smtp) ...@@ -68,7 +68,7 @@ mu_smtp_response (mu_smtp_t smtp)
68 MU_SMTP_CHECK_ERROR (smtp, rc); 68 MU_SMTP_CHECK_ERROR (smtp, rc);
69 if (n == 0) 69 if (n == 0)
70 MU_SMTP_CHECK_ERROR (smtp, EIO); 70 MU_SMTP_CHECK_ERROR (smtp, EIO);
71 n = mu_rtrim_cset (smtp->rdbuf, "\r\n"); 71 n = mu_rtrim_class (smtp->rdbuf, MU_CTYPE_ENDLN);
72 if (n < 3 || !mu_isdigit (smtp->rdbuf[0])) 72 if (n < 3 || !mu_isdigit (smtp->rdbuf[0]))
73 { 73 {
74 mu_diag_output (MU_DIAG_NOTICE, 74 mu_diag_output (MU_DIAG_NOTICE,
...@@ -101,7 +101,7 @@ mu_smtp_response (mu_smtp_t smtp) ...@@ -101,7 +101,7 @@ mu_smtp_response (mu_smtp_t smtp)
101 MU_SMTP_CHECK_ERROR (smtp, rc); 101 MU_SMTP_CHECK_ERROR (smtp, rc);
102 if (n == 0) 102 if (n == 0)
103 MU_SMTP_CHECK_ERROR (smtp, EIO); 103 MU_SMTP_CHECK_ERROR (smtp, EIO);
104 n = mu_rtrim_cset (smtp->rdbuf, "\r\n"); 104 n = mu_rtrim_class (smtp->rdbuf, MU_CTYPE_ENDLN);
105 if (n < 3 || memcmp (smtp->rdbuf, smtp->replcode, 3)) 105 if (n < 3 || memcmp (smtp->rdbuf, smtp->replcode, 3))
106 { 106 {
107 mu_diag_output (MU_DIAG_NOTICE, 107 mu_diag_output (MU_DIAG_NOTICE,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
28 #include <mailutils/cstr.h> 28 #include <mailutils/cstr.h>
29 #include <mailutils/io.h> 29 #include <mailutils/io.h>
30 #include <mailutils/filter.h> 30 #include <mailutils/filter.h>
31 #include <mailutils/cctype.h>
31 32
32 #define ATTRIBUTE_IS_DELETED(flag) (flag & MU_ATTRIBUTE_DELETED) 33 #define ATTRIBUTE_IS_DELETED(flag) (flag & MU_ATTRIBUTE_DELETED)
33 #define ATTRIBUTE_IS_EQUAL(flag1, flag2) (flag1 == flag2) 34 #define ATTRIBUTE_IS_EQUAL(flag1, flag2) (flag1 == flag2)
...@@ -381,7 +382,7 @@ mbox_envelope_date (mu_envelope_t envelope, char *buf, size_t len, ...@@ -381,7 +382,7 @@ mbox_envelope_date (mu_envelope_t envelope, char *buf, size_t len,
381 &n); 382 &n);
382 if (status) 383 if (status)
383 return status; 384 return status;
384 mu_rtrim_cset (buffer, "\r\n"); 385 mu_rtrim_class (buffer, MU_CTYPE_ENDLN);
385 386
386 /* Format: "From [sender] [date]" */ 387 /* Format: "From [sender] [date]" */
387 /* strlen ("From ") == 5 */ 388 /* strlen ("From ") == 5 */
...@@ -938,7 +939,7 @@ msg_envelope_to_stream (mu_stream_t out, mu_message_t msg) ...@@ -938,7 +939,7 @@ msg_envelope_to_stream (mu_stream_t out, mu_message_t msg)
938 return status; 939 return status;
939 } 940 }
940 941
941 mu_rtrim_cset (datestr, "\r\n"); 942 mu_rtrim_class (datestr, MU_CTYPE_ENDLN);
942 943
943 envarr[0] = "From "; 944 envarr[0] = "From ";
944 envarr[1] = sender; 945 envarr[1] = sender;
......
...@@ -640,7 +640,7 @@ pop_header_blurb (mu_stream_t stream, size_t maxlines, ...@@ -640,7 +640,7 @@ pop_header_blurb (mu_stream_t stream, size_t maxlines,
640 640
641 while ((status = mu_stream_getline (stream, &buf, &size, &n)) == 0 && n > 0) 641 while ((status = mu_stream_getline (stream, &buf, &size, &n)) == 0 && n > 0)
642 { 642 {
643 size_t len = mu_rtrim_cset (buf, "\r\n"); 643 size_t len = mu_rtrim_class (buf, MU_CTYPE_ENDLN);
644 if (len == 0) 644 if (len == 0)
645 break; 645 break;
646 mu_opool_append (opool, buf, len); 646 mu_opool_append (opool, buf, len);
......
...@@ -545,7 +545,7 @@ lmtp_loop (mu_stream_t iostr, unsigned int timeout) ...@@ -545,7 +545,7 @@ lmtp_loop (mu_stream_t iostr, unsigned int timeout)
545 enum lmtp_command cmd = cp->cmd_code; 545 enum lmtp_command cmd = cp->cmd_code;
546 enum lmtp_state next_state = transtab[cmd][state]; 546 enum lmtp_state next_state = transtab[cmd][state];
547 547
548 mu_rtrim_cset (sp, "\r\n"); 548 mu_rtrim_class (sp, MU_CTYPE_ENDLN);
549 549
550 if (next_state != state_none) 550 if (next_state != state_none)
551 { 551 {
......