aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit4a353c63099505dd5ab7d7143499e9fb318e4b60 (patch)
tree5879eead793eb937fc27454e1ca6abd6d58e2a9d /man.c
parentb2aa8ef6ed67716a593671e8bcb61ed84d083acd (diff)
downloadmandoc-4a353c63099505dd5ab7d7143499e9fb318e4b60.tar.gz
mandoc-4a353c63099505dd5ab7d7143499e9fb318e4b60.tar.zst
mandoc-4a353c63099505dd5ab7d7143499e9fb318e4b60.zip
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 1e7e341c..30e1ed1b 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.126 2014/03/23 12:26:58 schwarze Exp $ */
+/* $Id: man.c,v 1.127 2014/03/23 20:57:27 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -720,11 +720,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. */