Re: a bug of extra long line
On Sat, 10 Mar 2001, Lawrence Greenfield wrote: > Could you try the following comparison instead? > > p = buf + strlen(buf) - 1; > if (p == buf || (p[0] == '\n' && p[-1] != '\r')) { > /* either a \0 by itself or a \n without a \r */ > p[0] = '\r'; > p[1]
Re: a bug of extra long line
Could you try the following comparison instead? p = buf + strlen(buf) - 1; if (p == buf || (p[0] == '\n' && p[-1] != '\r')) { /* either a \0 by itself or a \n without a \r */ p[0] = '\r'; p[1] = '\n'; p[2] = '\0'; The test is import