wordwrap sucks

This commit is contained in:
Andrew Pamment 2018-02-27 21:59:04 +10:00
parent c52c3c2a9b
commit f5b136ae21

View File

@ -710,8 +710,18 @@ static char *www_wordwrap(char *content, int cutoff) {
if (ret == NULL) {
return NULL;
}
for (i=0;i<len;i++) {
if (content[i] == '\n') {
continue;
}
content[at++] = content[i];
}
content[at] = '\0';
at = 0;
len = strlen(content);
for (i=0;i<len-1;i++) {
if (content[i] == '\r' && content[i+1] != '\r') {
content[at++] = ' ';
content[at++] = content[i+1];
@ -730,9 +740,6 @@ static char *www_wordwrap(char *content, int cutoff) {
len = strlen(content);
ret = (char *)malloc(len + 1);
for (i=0;i<len;i++) {
if (content[i] == '\n') {
continue;
}
if (content[i] != '\r') {
ret[at] = content[i];
if (content[i] == ' ') {