1
0
Fork 0
forked from len0rd/rockbox

custom wps without an ending newline should still be OK

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2173 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-09-04 14:17:41 +00:00
parent 0f387e913a
commit 88aeb7140c

View file

@ -83,25 +83,29 @@ static void wps_format(char* fmt)
while (*buf)
{
switch (*buf++)
switch (*buf)
{
case '\r':
*(buf - 1) = 0;
*buf = 0;
break;
case '\n': /* LF */
*(buf - 1) = 0;
line++;
*buf = 0;
if (line < MAX_LINES)
if (++line < MAX_LINES)
{
format_lines[line] = buf;
/* the next line starts on the next byte */
format_lines[line] = buf+1;
}
break;
}
buf++;
}
if(buf != format_lines[line])
/* the last line didn't terminate with a newline */
line++;
for (; line < MAX_LINES; line++)
{
format_lines[line] = NULL;