=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.158 retrieving revision 1.159 diff -u -p -r1.158 -r1.159 --- mandoc/roff.c 2011/07/27 13:47:26 1.158 +++ mandoc/roff.c 2011/07/27 14:19:26 1.159 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.158 2011/07/27 13:47:26 kristaps Exp $ */ +/* $Id: roff.c,v 1.159 2011/07/27 14:19:26 kristaps Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -530,6 +530,9 @@ roff_parsetext(char *p) sz = strcspn(p, "-\\"); p += sz; + if ('\0' == *p) + break; + if ('\\' == *p) { /* Skip over escapes. */ p++; @@ -538,20 +541,19 @@ roff_parsetext(char *p) if (ESCAPE_ERROR == esc) break; continue; - } else if ('-' != *p || p == start) { + } else if (p == start) { p++; continue; } l = *(p - 1); r = *(p + 1); - if ('\\' != l && '\t' != r && '\t' != l && ' ' != r && ' ' != l && '-' != r && '-' != l && ! isdigit((unsigned char)l) && - ! isdigit((unsigned char)r)) + ! isdigit((unsigned char)r)) *p = ASCII_HYPH; p++; }