=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mandoc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/mandoc/mandoc.c 2010/06/26 17:56:43 1.14 --- src/usr.bin/mandoc/mandoc.c 2010/07/16 00:34:33 1.15 *************** *** 1,6 **** ! /* $Id: mandoc.c,v 1.14 2010/06/26 17:56:43 schwarze Exp $ */ /* ! * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above --- 1,6 ---- ! /* $Id: mandoc.c,v 1.15 2010/07/16 00:34:33 schwarze Exp $ */ /* ! * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above *************** *** 324,331 **** int ! mandoc_eos(const char *p, size_t sz) { if (0 == sz) return(0); --- 324,333 ---- int ! mandoc_eos(const char *p, size_t sz, int enclosed) { + const char *q; + int found = 0; if (0 == sz) return(0); *************** *** 336,343 **** * propogate outward. */ ! for ( ; sz; sz--) { ! switch (p[(int)sz - 1]) { case ('\"'): /* FALLTHROUGH */ case ('\''): --- 338,345 ---- * propogate outward. */ ! for (q = p + sz - 1; q >= p; q--) { ! switch (*q) { case ('\"'): /* FALLTHROUGH */ case ('\''): *************** *** 345,366 **** case (']'): /* FALLTHROUGH */ case (')'): break; case ('.'): - /* Escaped periods. */ - if (sz > 1 && '\\' == p[(int)sz - 2]) - return(0); /* FALLTHROUGH */ case ('!'): /* FALLTHROUGH */ case ('?'): ! return(1); default: ! return(0); } } ! return(0); } --- 347,368 ---- case (']'): /* FALLTHROUGH */ case (')'): + if (0 == found) + enclosed = 1; break; case ('.'): /* FALLTHROUGH */ case ('!'): /* FALLTHROUGH */ case ('?'): ! found = 1; ! break; default: ! return(found && (!enclosed || isalnum(*q))); } } ! return(found && !enclosed); }