diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-06-17 16:47:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-06-17 16:47:30 +0000 |
commit | bcc7aae8dc6902082508659d68e6553432cab6c7 (patch) | |
tree | 1c5864e63284a88d6923fc4c0cf670c965399e3b /usr.bin/mandoc/man_validate.c | |
parent | 7a83c249432e8c500f0cf6dc943449a04e5381cc (diff) |
if .in is used inside the .TP head, it's always relative
Diffstat (limited to 'usr.bin/mandoc/man_validate.c')
-rw-r--r-- | usr.bin/mandoc/man_validate.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index bf59a013f06..8e85eba162a 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.99 2017/06/11 19:36:31 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.100 2017/06/17 16:47:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -45,11 +45,12 @@ static void check_text(CHKARGS); static void post_AT(CHKARGS); static void post_IP(CHKARGS); -static void post_vs(CHKARGS); static void post_OP(CHKARGS); static void post_TH(CHKARGS); static void post_UC(CHKARGS); static void post_UR(CHKARGS); +static void post_in(CHKARGS); +static void post_vs(CHKARGS); static const v_check __man_valids[MAN_MAX - MAN_TH] = { post_TH, /* TH */ @@ -80,7 +81,7 @@ static const v_check __man_valids[MAN_MAX - MAN_TH] = { post_UC, /* UC */ NULL, /* PD */ post_AT, /* AT */ - NULL, /* in */ + post_in, /* in */ post_OP, /* OP */ NULL, /* EX */ NULL, /* EE */ @@ -433,6 +434,22 @@ post_AT(CHKARGS) } static void +post_in(CHKARGS) +{ + char *s; + + if (n->parent->tok != MAN_TP || + n->parent->type != ROFFT_HEAD || + n->child == NULL || + *n->child->string == '+' || + *n->child->string == '-') + return; + mandoc_asprintf(&s, "+%s", n->child->string); + free(n->child->string); + n->child->string = s; +} + +static void post_vs(CHKARGS) { |