+ /** Need to parse each line of the message here since someone may have sent
+ * a message containing a single dot on a line of its own. In that case we
+ * need to escape it in accordance with RFC821.
+ * We could do this with the tokenizer functions but num_tokens returns an
+ * int and the message may contain more lines than that, also copying each
+ * line would be slow.
+ */
+ nextline = msgtext;
+ while (*nextline)
+ {
+ chunk_to_send = nextline;
+ while (*nextline != '\n')
+ nextline++;
+ nextline++;
+ prev_char = *nextline;
+ *nextline = '\0';
+ if (!strcmp(chunk_to_send, ".\r\n");
+ sock_write(sock, "..\r\n", 4);
+ else
+ sock_write(sock, chunk_to_send, (size_t)(nextline-chunk_to_send));
+ *nextline = prev_char;
+ }
+