if (c >= '0' && c <= '9') { ret = c - '0'; }
else if (c >= 'A' && c <= 'F') { ret = c - 'A' + 10; }
else if (c >= 'a' && c <= 'f') { ret = c - 'a' + 10; }
- else if (c == '\r' || c == '\n') {
- /* Soft line break */
- while (remain > 0 && (*p == '\r' || *p == '\n')) {
- remain --;
+ else if (c == '\r') {
+ /* Eat one more endline */
+ if (remain > 0 && *p == '\n') {
p ++;
+ remain --;
}
continue;
}
+ else if (c == '\n') {
+ /* Soft line break */
+ continue;
+ }
else {
/* Hack, hack, hack, treat =<garbadge> as =<garbadge> */
if (remain > 0) {
'Mailscape External Mail Flow Outbound Test=',
'asan found'
},
+ {
+ 'foo=\n\nbar',
+ 'foo\nbar',
+ 'Soft newline followed by hard newline (LF)',
+ },
+ {
+ 'foo=\r\n\r\nbar',
+ 'foo\r\nbar',
+ 'Soft newline followed by hard newline (CRLF)',
+ },
}
for _,c in ipairs(cases) do