summaryrefslogtreecommitdiff
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
parent0f387e913abb2cb53578088246eff81eca7beaf2 (diff)
downloadrockbox-88aeb7140cd46bf14009d463e2d5209684d405ec.tar.gz
rockbox-88aeb7140cd46bf14009d463e2d5209684d405ec.zip
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
-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)
83 83
84 while (*buf) 84 while (*buf)
85 { 85 {
86 switch (*buf++) 86 switch (*buf)
87 { 87 {
88 case '\r': 88 case '\r':
89 *(buf - 1) = 0; 89 *buf = 0;
90 break; 90 break;
91 91
92 case '\n': /* LF */ 92 case '\n': /* LF */
93 *(buf - 1) = 0; 93 *buf = 0;
94 line++;
95 94
96 if (line < MAX_LINES) 95 if (++line < MAX_LINES)
97 { 96 {
98 format_lines[line] = buf; 97 /* the next line starts on the next byte */
98 format_lines[line] = buf+1;
99 } 99 }
100
101 break; 100 break;
102 } 101 }
102 buf++;
103 } 103 }
104 104
105 if(buf != format_lines[line])
106 /* the last line didn't terminate with a newline */
107 line++;
108
105 for (; line < MAX_LINES; line++) 109 for (; line < MAX_LINES; line++)
106 { 110 {
107 format_lines[line] = NULL; 111 format_lines[line] = NULL;