]> code.citadel.org Git - citadel.git/blobdiff - citadel/clientsocket.c
* SMTP hacks to deal with AOL braindamage
[citadel.git] / citadel / clientsocket.c
index f645e9261cd231e205ab6f8ab7449cccb2251063..a7a7e82c23445b7edff09c4428f8ad0d6294b66a 100644 (file)
@@ -169,8 +169,8 @@ int ml_sock_gets(int sock, char *buf) {
        int g;
 
        g = sock_gets(sock, buf);
-       if (g < 0) return(g);
-       if ( (g < 4) || (buf[3] != '-')) return(g);
+       if (g < 4) return(g);
+       if (buf[3] != '-') return(g);
 
        do {
                g = sock_gets(sock, bigbuf);
@@ -195,3 +195,19 @@ int sock_puts(int sock, char *buf)
        if (j<0) return(j);
        return(i+j);
 }
+
+
+/*
+ * sock_puts_crlf() - same as sock_puts() but ends line with CRLF, not LF
+ * Returns the number of bytes written, or -1 for error.
+ */
+int sock_puts_crlf(int sock, char *buf)
+{
+       int i, j;
+
+       i = sock_write(sock, buf, strlen(buf));
+       if (i<0) return(i);
+       j = sock_write(sock, "\r\n", 2);
+       if (j<0) return(j);
+       return(i+j);
+}