summaryrefslogtreecommitdiff
path: root/apps/wps-display.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-09-04 14:17:41 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-09-04 14:17:41 +0000
commit88aeb7140cd46bf14009d463e2d5209684d405ec (patch)
tree3e7c3682a79be49ac59dba3857a4a65a9ddeba81 /apps/wps-display.c
parent0f387e913abb2cb53578088246eff81eca7beaf2 (diff)
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
Diffstat (limited to 'apps/wps-display.c')
-rw-r--r--apps/wps-display.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 3bd921ba3c..f21edb002a 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -83,25 +83,29 @@ static void wps_format(char* fmt)
while (*buf)
{
- switch (*buf++)
+ switch (*buf)
{
case '\r':
- *(buf - 1) = 0;
- break;
+ *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;