summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-23 20:57:27 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-23 20:57:27 +0000
commit76706dce46c9ff816e3742eecf47abd34dd4bd99 (patch)
tree9f845e16be661ae7348e51a2fbc8b8d7aab9d0cf /man.c
parentc244d5b73aa452edd7804e73e9f7ef35d827b30f (diff)
downloadmandoc-76706dce46c9ff816e3742eecf47abd34dd4bd99.tar.gz
Skip leading escape sequences in man_deroff(). Helps indexing of
some manuals containing overzealous escaping in their NAME section.
Diffstat (limited to 'man.c')
-rw-r--r--man.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/man.c b/man.c
index 88bce3f0..2fa49fb8 100644
--- a/man.c
+++ b/man.c
@@ -720,11 +720,18 @@ man_deroff(char **dest, const struct man_node *n)
return;
}
- /* Skip leading whitespace. */
-
- for (cp = n->string; '\0' != *cp; cp++)
- if (0 == isspace((unsigned char)*cp))
+ /* Skip leading whitespace and escape sequences. */
+
+ cp = n->string;
+ while ('\0' != *cp) {
+ if ('\\' == *cp) {
+ cp++;
+ mandoc_escape((const char **)&cp, NULL, NULL);
+ } else if (isspace((unsigned char)*cp))
+ cp++;
+ else
break;
+ }
/* Skip trailing whitespace. */