diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-04-17 07:57:06 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-04-17 07:57:06 +0000 |
commit | 68b96cb4f8258c5120b8daec819cb8ae2456f399 (patch) | |
tree | 403b0993b7b42e3dc84a9cdbd502f824e02a7081 /driver.c | |
parent | ddb99a133d2301974d24b41b19210f3c03bc708c (diff) | |
download | fetchmail-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.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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') |