From 93acb30c22f0dc8169193ebcefdab76c39f6160f Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Thu, 29 Nov 2007 19:14:57 +0000 Subject: [PATCH] Convert '\\n' -> '\r\n' SVN revision: 1973 --- src/elog.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/elog.c b/src/elog.c index b7378c4a..c2e33410 100755 --- a/src/elog.c +++ b/src/elog.c @@ -257,6 +257,21 @@ void add_crlf(char *buffer, int bufsize) /*------------------------------------------------------------------*/ +void convert_crlf(char *buffer, int bufsize) +{ + char *p; + + /* convert '\n' -> \r\n */ + p = buffer; + while ((p = strstr(p, "\\n")) != NULL) { + + *(p++) = '\r'; + *(p++) = '\n'; + } +} + +/*------------------------------------------------------------------*/ + char request[100000], response[100000], *content; INT retrieve_elog(char *host, int port, char *subdir, char *experiment, @@ -1014,8 +1029,10 @@ int main(int argc, char *argv[]) printf("Multiple attributes and attachments can be supplied\n"); return 1; } - } else + } else { strcpy(text, argv[i]); + convert_crlf(text, sizeof(text)); + } } }