=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/main.c,v retrieving revision 1.69 retrieving revision 1.70 diff -c -r1.69 -r1.70 *** src/usr.bin/mandoc/main.c 2011/01/20 21:33:11 1.69 --- src/usr.bin/mandoc/main.c 2011/01/24 23:40:12 1.70 *************** *** 1,7 **** ! /* $Id: main.c,v 1.69 2011/01/20 21:33:11 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons ! * Copyright (c) 2010 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,7 ---- ! /* $Id: main.c,v 1.70 2011/01/24 23:40:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons ! * Copyright (c) 2010, 2011 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 669,674 **** --- 669,684 ---- } while (i < (int)blk.sz && (start || '\0' != blk.buf[i])) { + + /* + * When finding an unescaped newline character, + * leave the character loop to process the line. + * Skip a preceding carriage return, if any. + */ + + if ('\r' == blk.buf[i] && i + 1 < (int)blk.sz && + '\n' == blk.buf[i + 1]) + ++i; if ('\n' == blk.buf[i]) { ++i; ++lnn; *************** *** 703,713 **** continue; } ! /* Found escape & at least one other char. */ if ('\n' == blk.buf[i + 1]) { i += 2; - /* Escaped newlines are skipped over */ ++lnn; continue; } --- 713,730 ---- continue; } ! /* ! * Found escape and at least one other character. ! * When it's a newline character, skip it. ! * When there is a carriage return in between, ! * skip that one as well. ! */ + if ('\r' == blk.buf[i + 1] && i + 2 < (int)blk.sz && + '\n' == blk.buf[i + 2]) + ++i; if ('\n' == blk.buf[i + 1]) { i += 2; ++lnn; continue; }