=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.155 retrieving revision 1.159 diff -u -p -r1.155 -r1.159 --- mandoc/roff.c 2011/07/27 07:32:26 1.155 +++ mandoc/roff.c 2011/07/27 14:19:26 1.159 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.155 2011/07/27 07:32: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 @@ -166,6 +166,8 @@ static const char *roff_getstrn(const struct roff *, const char *, size_t); static enum rofferr roff_line_ignore(ROFF_ARGS); static enum rofferr roff_nr(ROFF_ARGS); +static void roff_openeqn(struct roff *, const char *, + int, int, const char *); static enum rofft roff_parse(struct roff *, const char *, int *); static enum rofferr roff_parsetext(char *); static void roff_res(struct roff *, @@ -528,6 +530,9 @@ roff_parsetext(char *p) sz = strcspn(p, "-\\"); p += sz; + if ('\0' == *p) + break; + if ('\\' == *p) { /* Skip over escapes. */ p++; @@ -536,18 +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++; } @@ -1258,14 +1264,16 @@ roff_T_(ROFF_ARGS) return(ROFF_IGN); } -int +#if 0 +static int roff_closeeqn(struct roff *r) { return(r->eqn && ROFF_EQN == eqn_end(&r->eqn) ? 1 : 0); } +#endif -void +static void roff_openeqn(struct roff *r, const char *name, int line, int offs, const char *buf) { @@ -1515,11 +1523,12 @@ roff_getstrn(const struct roff *r, const char *name, s { const struct roffstr *n; - n = r->first_string; - while (n && (strncmp(name, n->name, len) || '\0' != n->name[(int)len])) - n = n->next; + for (n = r->first_string; n; n = n->next) + if (0 == strncmp(name, n->name, len) && + '\0' == n->name[(int)len]) + return(n->string); - return(n ? n->string : NULL); + return(NULL); } static void