=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc.c,v retrieving revision 1.117 retrieving revision 1.118 diff -c -r1.117 -r1.118 *** src/usr.bin/mandoc/mdoc.c 2014/10/20 15:49:45 1.117 --- src/usr.bin/mandoc/mdoc.c 2014/11/19 03:07:43 1.118 *************** *** 1,4 **** ! /* $OpenBSD: mdoc.c,v 1.117 2014/10/20 15:49:45 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: mdoc.c,v 1.118 2014/11/19 03:07:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze *************** *** 732,768 **** static int mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) { enum mdoct tok; int i, sv; char mac[5]; - struct mdoc_node *n; sv = offs; /* * Copy the first word into a nil-terminated buffer. ! * Stop copying when a tab, space, or eoln is encountered. */ i = 0; ! while (i < 4 && '\0' != buf[offs] && ' ' != buf[offs] && ! '\t' != buf[offs]) mac[i++] = buf[offs++]; mac[i] = '\0'; tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX; ! if (MDOC_MAX == tok) { mandoc_msg(MANDOCERR_MACRO, mdoc->parse, ln, sv, buf + sv - 1); return(1); } ! /* Disregard the first trailing tab, if applicable. */ ! if ('\t' == buf[offs]) offs++; /* Jump to the next non-whitespace word. */ --- 732,778 ---- static int mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) { + struct mdoc_node *n; + const char *cp; enum mdoct tok; int i, sv; char mac[5]; sv = offs; /* * Copy the first word into a nil-terminated buffer. ! * Stop when a space, tab, escape, or eoln is encountered. */ i = 0; ! while (i < 4 && strchr(" \t\\", buf[offs]) == NULL) mac[i++] = buf[offs++]; mac[i] = '\0'; tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX; ! if (tok == MDOC_MAX) { mandoc_msg(MANDOCERR_MACRO, mdoc->parse, ln, sv, buf + sv - 1); return(1); } ! /* Skip a leading escape sequence or tab. */ ! switch (buf[offs]) { ! case '\\': ! cp = buf + offs + 1; ! mandoc_escape(&cp, NULL, NULL); ! offs = cp - buf; ! break; ! case '\t': offs++; + break; + default: + break; + } /* Jump to the next non-whitespace word. */