summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2018-08-16 23:40:20 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2018-08-16 23:40:20 +0000
commit12786e24157cc009ad032c2749a5f045ee5236b2 (patch)
tree6cfcc228698ae869583ecd5f35e70fbcb1922763 /usr.bin
parent9f4609bc4d16219308383e1b121d98482b774aa1 (diff)
implement the GNU man-ext .TQ macro in man(7),
used for example by groff_diff(7)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/man_html.c27
-rw-r--r--usr.bin/mandoc/man_macro.c5
-rw-r--r--usr.bin/mandoc/man_term.c6
-rw-r--r--usr.bin/mandoc/man_validate.c3
-rw-r--r--usr.bin/mandoc/roff.c3
-rw-r--r--usr.bin/mandoc/roff.h3
6 files changed, 27 insertions, 20 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 39016c56983..487bf9d2d0b 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_html.c,v 1.106 2018/07/27 17:47:05 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.107 2018/08/16 23:40:19 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -73,6 +73,7 @@ static const struct htmlman __mans[MAN_MAX - MAN_TH] = {
{ man_SH_pre, NULL }, /* SH */
{ man_SS_pre, NULL }, /* SS */
{ man_IP_pre, NULL }, /* TP */
+ { man_IP_pre, NULL }, /* TQ */
{ man_PP_pre, NULL }, /* LP */
{ man_PP_pre, NULL }, /* PP */
{ man_PP_pre, NULL }, /* P */
@@ -516,25 +517,25 @@ man_IP_pre(MAN_ARGS)
return 1;
}
- /* FIXME: width specification. */
-
print_otag(h, TAG_DT, "");
- /* For IP, only print the first header element. */
-
- if (MAN_IP == n->tok && n->child)
- print_man_node(man, n->child, h);
-
- /* For TP, only print next-line header elements. */
-
- if (MAN_TP == n->tok) {
+ switch(n->tok) {
+ case MAN_IP: /* Only print the first header element. */
+ if (n->child != NULL)
+ print_man_node(man, n->child, h);
+ break;
+ case MAN_TP: /* Only print next-line header elements. */
+ case MAN_TQ:
nn = n->child;
- while (NULL != nn && 0 == (NODE_LINE & nn->flags))
+ while (nn != NULL && (NODE_LINE & nn->flags) == 0)
nn = nn->next;
- while (NULL != nn) {
+ while (nn != NULL) {
print_man_node(man, nn, h);
nn = nn->next;
}
+ break;
+ default:
+ abort();
}
return 0;
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 59e22c4b597..6191777300a 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_macro.c,v 1.87 2018/08/15 15:36:11 schwarze Exp $ */
+/* $OpenBSD: man_macro.c,v 1.88 2018/08/16 23:40:19 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -43,6 +43,7 @@ const struct man_macro __man_macros[MAN_MAX - MAN_TH] = {
{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SH */
{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SS */
{ blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* TP */
+ { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* TQ */
{ blk_imp, MAN_BSCOPE }, /* LP */
{ blk_imp, MAN_BSCOPE }, /* PP */
{ blk_imp, MAN_BSCOPE }, /* P */
@@ -325,7 +326,7 @@ blk_imp(MACRO_PROT_ARGS)
*/
if (man_macros[tok].flags & MAN_SCOPED &&
- (tok == MAN_TP || n == man->last)) {
+ (tok == MAN_TP || tok == MAN_TQ || n == man->last)) {
man->flags |= MAN_BLINE;
return;
}
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 6197f65a0c4..76133ba8bf0 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_term.c,v 1.165 2018/08/14 01:26:12 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.166 2018/08/16 23:40:19 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -96,6 +96,7 @@ static const struct termact __termacts[MAN_MAX - MAN_TH] = {
{ pre_SH, post_SH, 0 }, /* SH */
{ pre_SS, post_SS, 0 }, /* SS */
{ pre_TP, post_TP, 0 }, /* TP */
+ { pre_TP, post_TP, 0 }, /* TQ */
{ pre_PP, NULL, 0 }, /* LP */
{ pre_PP, NULL, 0 }, /* PP */
{ pre_PP, NULL, 0 }, /* P */
@@ -582,7 +583,8 @@ pre_TP(DECL_ARGS)
p->flags |= TERMP_NOSPACE;
break;
case ROFFT_BLOCK:
- print_bvspace(p, n, mt->pardist);
+ if (n->tok == MAN_TP)
+ print_bvspace(p, n, mt->pardist);
/* FALLTHROUGH */
default:
return 1;
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index d35048d030b..01e38bc6f83 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.106 2018/08/16 15:04:45 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.107 2018/08/16 23:40:19 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -57,6 +57,7 @@ static const v_check man_valids[MAN_MAX - MAN_TH] = {
NULL, /* SH */
NULL, /* SS */
NULL, /* TP */
+ NULL, /* TQ */
check_par, /* LP */
check_par, /* PP */
check_par, /* P */
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 6c6261ea80f..c2f6f982300 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.203 2018/08/16 13:49:40 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.204 2018/08/16 23:40:19 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -325,6 +325,7 @@ const char *__roff_name[MAN_MAX + 1] = {
"Dx", "%Q", "%U", "Ta",
NULL,
"TH", "SH", "SS", "TP",
+ "TQ",
"LP", "PP", "P", "IP",
"HP", "SM", "SB", "BI",
"IB", "BR", "RB", "R",
diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h
index a13d9662bf1..1c5fd059b12 100644
--- a/usr.bin/mandoc/roff.h
+++ b/usr.bin/mandoc/roff.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.h,v 1.41 2018/04/11 17:10:35 schwarze Exp $ */
+/* $OpenBSD: roff.h,v 1.42 2018/08/16 23:40:19 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -438,6 +438,7 @@ enum roff_tok {
MAN_SH,
MAN_SS,
MAN_TP,
+ MAN_TQ,
MAN_LP,
MAN_PP,
MAN_P,