aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tag.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-11-08 15:57:28 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-11-08 15:57:28 +0000
commit2d6872863fef3132383ac8d39eeedd2bc85bbad1 (patch)
tree321be602889c8158e4043861a3316b24027a6f1c /tag.c
parente9803aa7cf0eeb6e692808a1ae7cf7ab263a8e9e (diff)
downloadmandoc-2d6872863fef3132383ac8d39eeedd2bc85bbad1.tar.gz
mandoc-2d6872863fef3132383ac8d39eeedd2bc85bbad1.tar.zst
mandoc-2d6872863fef3132383ac8d39eeedd2bc85bbad1.zip
skip leading \& and \e in tags
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tag.c b/tag.c
index c517e3ab..fd9f2a11 100644
--- a/tag.c
+++ b/tag.c
@@ -1,4 +1,4 @@
-/* $Id: tag.c,v 1.14 2016/11/08 15:28:17 schwarze Exp $ */
+/* $Id: tag.c,v 1.15 2016/11/08 15:57:28 schwarze Exp $ */
/*
* Copyright (c) 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -130,7 +130,13 @@ tag_put(const char *s, int prio, size_t line)
size_t len;
unsigned int slot;
- if (tag_files.tfd <= 0 || strchr(s, ' ') != NULL)
+ /* Sanity checks. */
+
+ if (tag_files.tfd <= 0)
+ return;
+ if (s[0] == '\\' && (s[1] == '&' || s[1] == 'e'))
+ s += 2;
+ if (*s == '\0' || strchr(s, ' ') != NULL)
return;
slot = ohash_qlookup(&tag_data, s);