diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-05 21:32:53 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-05 21:32:53 +0100 |
commit | f7e07dcfdb461b8fb997d0711e4d2cf373cfb249 (patch) | |
tree | bef18c9b88f943d525c39365712513031c8d8580 /parse.c | |
parent | Made scheme code work again. (diff) | |
download | calp-f7e07dcfdb461b8fb997d0711e4d2cf373cfb249.tar.gz calp-f7e07dcfdb461b8fb997d0711e4d2cf373cfb249.tar.xz |
Add support for NL without preceeding CR.
Diffstat (limited to '')
-rw-r--r-- | parse.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -42,11 +42,17 @@ int parse_file(char* fname, FILE* f, vcalendar* cal) { * end. The following character should always be \n. * However, if the first character on the next line is a * whitespace then the two lines should be concatenated. + * + * NOTE + * The above is true according to the standard. But I have + * found files with only NL. The code below ends line on the + * first of NL or CR, and then ensures that the program thinks + * it got the expected CRNL. */ - if (c == '\r') { + if (c == '\r' || c == '\n') { char s[2]; - s[0] = fgetc(f); + s[0] = (c == '\n' ? '\n' : fgetc(f)); s[1] = fgetc(f); if (s[0] != '\n') { ERR_F("%s, %i", "expected newline after CR", line); } |