summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-23 20:57:24 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-23 20:57:24 +0000
commit646ec145f158b02757cfd5cd123d9f5fb5b51678 (patch)
tree1a75f55d05d8e4f81ffa4ae651d37e1d62f1ba4a
parent6b2daaa1913ef32fab1987419a00c9038273ffc7 (diff)
Skip leading escape sequences in man_deroff(). Helps indexing of
some manuals containing overzealous escaping in their NAME section.
-rw-r--r--usr.bin/mandoc/man.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index bd1cfd729d4..ced7146831b 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.76 2014/03/22 00:56:07 schwarze Exp $ */
+/* $Id: man.c,v 1.77 2014/03/23 20:57:23 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -716,11 +716,18 @@ man_deroff(char **dest, const struct man_node *n)
return;
}
- /* Skip leading whitespace. */
+ /* Skip leading whitespace and escape sequences. */
- for (cp = n->string; '\0' != *cp; cp++)
- if (0 == isspace((unsigned char)*cp))
+ 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. */