Index: lib/misc.c =================================================================== --- lib/misc.c (revision 7339) +++ lib/misc.c (working copy) @@ -207,8 +207,7 @@ char *msg_data(char *msg, int stripcr) { /* Find the start position of the data following the "status host.test " message */ - static strbuffer_t *result = NULL; - char *bol; + char *bol, *cr; if (!msg || (*msg == '\0')) return msg; @@ -222,27 +221,14 @@ bol += strspn(bol, " \t"); /* Skip all whitespace */ if (!stripcr) return bol; - if (!result) result = newstrbuffer(0); else clearstrbuffer(result); - while (bol && *bol) { - char *eoln, savchar; - - eoln = bol + strcspn(bol, "\r\n"); - if (eoln) { - savchar = *eoln; - *eoln = '\0'; - addtobuffer(result, bol); - addtobuffer(result, "\n"); - *eoln = savchar; - bol = eoln + 1; - if ((savchar == '\r') && (*bol == '\n')) bol++; - } - else { - addtobuffer(result, bol); - bol = NULL; - } - } + /* Replace with blanks */ + cr = bol; + do { + cr = strchr(cr, '\r'); + if (cr) *cr = ' '; + } while (cr); - return STRBUF(result); + return bol; } char *gettok(char *s, char *delims)