=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mandoc.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/mandoc/mandoc.c 2011/09/18 15:54:48 1.28 --- src/usr.bin/mandoc/mandoc.c 2011/10/24 20:29:21 1.29 *************** *** 1,4 **** ! /* $Id: mandoc.c,v 1.28 2011/09/18 15:54:48 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze --- 1,4 ---- ! /* $Id: mandoc.c,v 1.29 2011/10/24 20:29:21 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze *************** *** 157,164 **** case ('V'): /* FALLTHROUGH */ case ('Y'): ! if (ESCAPE_ERROR == gly) ! gly = ESCAPE_IGNORE; /* FALLTHROUGH */ case ('f'): if (ESCAPE_ERROR == gly) --- 157,163 ---- case ('V'): /* FALLTHROUGH */ case ('Y'): ! gly = ESCAPE_IGNORE; /* FALLTHROUGH */ case ('f'): if (ESCAPE_ERROR == gly) *************** *** 218,228 **** case ('L'): /* FALLTHROUGH */ case ('l'): /* FALLTHROUGH */ - case ('N'): - if (ESCAPE_ERROR == gly) - gly = ESCAPE_NUMBERED; - /* FALLTHROUGH */ case ('S'): /* FALLTHROUGH */ case ('v'): --- 217,224 ---- case ('L'): /* FALLTHROUGH */ case ('l'): + gly = ESCAPE_NUMBERED; /* FALLTHROUGH */ case ('S'): /* FALLTHROUGH */ case ('v'): *************** *** 236,241 **** --- 232,257 ---- return(ESCAPE_ERROR); term = numeric = '\''; break; + + /* + * Special handling for the numbered character escape. + * XXX Do any other escapes need similar handling? + */ + case ('N'): + if ('\0' == cp[i]) + return(ESCAPE_ERROR); + *end = &cp[++i]; + if (isdigit((unsigned char)cp[i-1])) + return(ESCAPE_IGNORE); + while (isdigit((unsigned char)**end)) + (*end)++; + if (start) + *start = &cp[i]; + if (sz) + *sz = *end - &cp[i]; + if ('\0' != **end) + (*end)++; + return(ESCAPE_NUMBERED); /* * Sizes get a special category of their own.