aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2010-08-08 14:51:32 +0000
committerIngo Schwarze <schwarze@openbsd.org>2010-08-08 14:51:32 +0000
commit0ce539688658d136200d6e00abbb9db7b7a7c363 (patch)
tree829a19e0b276e322e1be1043e78d6a6e4506f88c /man.c
parent60d06b6c8ec84a910dd17c21f2e368ae8e32dc10 (diff)
downloadmandoc-0ce539688658d136200d6e00abbb9db7b7a7c363.tar.gz
mandoc-0ce539688658d136200d6e00abbb9db7b7a7c363.tar.zst
mandoc-0ce539688658d136200d6e00abbb9db7b7a7c363.zip
simplify the code copying the macro name, and sync the
accompagnying comment between man_pmacro() and mdoc_pmacro(); ok'd by kristaps@ together with main.c rev. 1.102
Diffstat (limited to 'man.c')
-rw-r--r--man.c16
1 files changed, 8 insertions, 8 deletions
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 <kristaps@bsd.lv>
*
@@ -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) {