aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-04-17 07:57:06 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-04-17 07:57:06 +0000
commit68b96cb4f8258c5120b8daec819cb8ae2456f399 (patch)
tree403b0993b7b42e3dc84a9cdbd502f824e02a7081 /driver.c
parentddb99a133d2301974d24b41b19210f3c03bc708c (diff)
downloadfetchmail-68b96cb4f8258c5120b8daec819cb8ae2456f399.tar.gz
fetchmail-68b96cb4f8258c5120b8daec819cb8ae2456f399.tar.bz2
fetchmail-68b96cb4f8258c5120b8daec819cb8ae2456f399.zip
Added forcecr option.
svn path=/trunk/; revision=963
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/driver.c b/driver.c
index 753b90ec..701224f0 100644
--- a/driver.c
+++ b/driver.c
@@ -466,6 +466,19 @@ char *realname; /* real name of host */
do {
if (!SockGets(buf, sizeof(buf)-1, sockfp))
return(PS_SOCKET);
+
+ /* lines may not be properly CRLF terminated; fix this for qmail */
+ if (ctl->forcecr)
+ {
+ cp = buf + strlen(buf) - 1;
+ if (cp > buf && *cp == '\n' && cp[-1] != '\r')
+ {
+ *cp++ = '\r';
+ *cp++ = '\n';
+ *cp++ = '\0';
+ }
+ }
+
set_timeout(ctl->server.timeout);
/* leave extra room for reply_hack to play with */
line = realloc(line, strlen(line) + strlen(buf) + HOSTLEN + 1);
@@ -1008,6 +1021,18 @@ char *realname; /* real name of host */
}
remaining -= n;
+ /* fix messages that have only \n line-termination (for qmail) */
+ if (ctl->forcecr)
+ {
+ cp = buf + strlen(buf) - 1;
+ if (cp > buf && *cp == '\n' && cp[-1] != '\r')
+ {
+ *cp++ = '\r';
+ *cp++ = '\n';
+ *cp++ = '\0';
+ }
+ }
+
/* check for end of message */
if (delimited && *buf == '.')
if (buf[1] == '\r' && buf[2] == '\n')