X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/2e99d649451cc990d3b8e8663705ad2ef1c25eb1..c75a70fe96c444404797d0ca3abc9edf5076a713:/man.c diff --git a/man.c b/man.c index bf65d919..d0e577a6 100644 --- a/man.c +++ b/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.85 2010/08/07 20:57:33 kristaps Exp $ */ +/* $Id: man.c,v 1.86 2010/08/08 14:51:32 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -480,14 +480,14 @@ man_pmacro(struct man *m, int ln, char *buf, int offs) ppos = i; - /* Copy the first word into a nil-terminated buffer. */ - - for (j = 0; j < 4; j++, i++) - if ('\0' == (mac[j] = buf[i])) - break; - else if (' ' == buf[i]) - break; + /* + * Copy the first word into a nil-terminated buffer. + * Stop copying when a tab, space, or eoln is encountered. + */ + j = 0; + while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i]) + mac[j++] = buf[i++]; mac[j] = '\0'; if (j == 4 || j < 1) {