summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2012-07-08 18:38:07 +0000
committerschwarze <schwarze@openbsd.org>2012-07-08 18:38:07 +0000
commitfb6b72770d330f6934603e5ee43a11a0334d41f2 (patch)
tree8e17818c919c886ca62b218d0e269abd921eaf02
parentset_pid() does not need prompt string, low or high parameters. These (diff)
downloadwireguard-openbsd-fb6b72770d330f6934603e5ee43a11a0334d41f2.tar.xz
wireguard-openbsd-fb6b72770d330f6934603e5ee43a11a0334d41f2.zip
fix vertical spacing for -Tman SYNOPSIS .Fn .Fo .Ft .In .Nm .Va .Vt
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/basic.in24
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fo/basic.out_ascii16
-rw-r--r--regress/usr.bin/mandoc/mdoc/In/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/In/break.in10
-rw-r--r--regress/usr.bin/mandoc/mdoc/In/break.out_ascii5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Makefile4
-rw-r--r--regress/usr.bin/mandoc/mdoc/Va/Makefile5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Va/basic.in14
-rw-r--r--regress/usr.bin/mandoc/mdoc/Va/basic.out_ascii10
-rw-r--r--usr.bin/mandoc/mdoc_man.c77
11 files changed, 155 insertions, 22 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/Makefile b/regress/usr.bin/mandoc/mdoc/Fo/Makefile
index 0b75bdae4f6..a08826a0d30 100644
--- a/regress/usr.bin/mandoc/mdoc/Fo/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Fo/Makefile
@@ -1,11 +1,9 @@
-# $OpenBSD: Makefile,v 1.3 2011/11/17 16:28:45 schwarze Exp $
+# $OpenBSD: Makefile,v 1.4 2012/07/08 18:38:07 schwarze Exp $
-REGRESS_TARGETS=section noarg
+REGRESS_TARGETS = basic section noarg
# groff 1.21 does not handle .nr nS
SKIP_GROFF ?= section
-SKIP_TMAN ?= ALL
-
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/basic.in b/regress/usr.bin/mandoc/mdoc/Fo/basic.in
new file mode 100644
index 00000000000..5572ba63385
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/basic.in
@@ -0,0 +1,24 @@
+.Dd July 7, 2012
+.Dt FO-BASIC 1
+.Os OpenBSD
+.Sh NAME
+.Nm Fo-basic
+.Nd function blocks
+.Sh SYNOPSIS
+.Ft double
+.Fo sin
+.Fa "double x"
+.Fc
+.Ft double
+.Fo atan2
+.Fa "double y" "double x"
+.Fc
+.Sh DESCRIPTION
+.Ft double
+.Fo sin
+.Fa "double x"
+.Fc
+.Ft double
+.Fo atan2
+.Fa "double y" "double x"
+.Fc
diff --git a/regress/usr.bin/mandoc/mdoc/Fo/basic.out_ascii b/regress/usr.bin/mandoc/mdoc/Fo/basic.out_ascii
new file mode 100644
index 00000000000..9d8288232b1
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fo/basic.out_ascii
@@ -0,0 +1,16 @@
+FO-BASIC(1) OpenBSD Reference Manual FO-BASIC(1)
+
+NNAAMMEE
+ FFoo--bbaassiicc - function blocks
+
+SSYYNNOOPPSSIISS
+ _d_o_u_b_l_e
+ ssiinn(_d_o_u_b_l_e _x);
+
+ _d_o_u_b_l_e
+ aattaann22(_d_o_u_b_l_e _y, _d_o_u_b_l_e _x);
+
+DDEESSCCRRIIPPTTIIOONN
+ _d_o_u_b_l_e ssiinn(_d_o_u_b_l_e _x) _d_o_u_b_l_e aattaann22(_d_o_u_b_l_e _y, _d_o_u_b_l_e _x)
+
+OpenBSD July 7, 2012 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/In/Makefile b/regress/usr.bin/mandoc/mdoc/In/Makefile
index e7452841ca7..85ed4ec65aa 100644
--- a/regress/usr.bin/mandoc/mdoc/In/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/In/Makefile
@@ -1,7 +1,5 @@
-# $OpenBSD: Makefile,v 1.2 2011/11/17 16:28:45 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2012/07/08 18:38:07 schwarze Exp $
-REGRESS_TARGETS=break
-
-SKIP_TMAN ?= break
+REGRESS_TARGETS = break
.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/In/break.in b/regress/usr.bin/mandoc/mdoc/In/break.in
index 7e156be74a9..0e26731bced 100644
--- a/regress/usr.bin/mandoc/mdoc/In/break.in
+++ b/regress/usr.bin/mandoc/mdoc/In/break.in
@@ -14,3 +14,13 @@
.Fn dup "int oldd"
.Ft ssize_t
.Fn write "int d" "const void *buf" "size_t nbytes"
+.Sh DESCRIPTION
+.In fcntl.h
+.Ft int
+.Fn open "const char *path" "int flags" "mode_t mode"
+.In sys/types.h
+.In unistd.h
+.Ft int
+.Fn dup "int oldd"
+.Ft ssize_t
+.Fn write "int d" "const void *buf" "size_t nbytes"
diff --git a/regress/usr.bin/mandoc/mdoc/In/break.out_ascii b/regress/usr.bin/mandoc/mdoc/In/break.out_ascii
index 6811a698aee..51b2de76943 100644
--- a/regress/usr.bin/mandoc/mdoc/In/break.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/In/break.out_ascii
@@ -18,4 +18,9 @@ SSYYNNOOPPSSIISS
_s_s_i_z_e___t
wwrriittee(_i_n_t _d, _c_o_n_s_t _v_o_i_d _*_b_u_f, _s_i_z_e___t _n_b_y_t_e_s);
+DDEESSCCRRIIPPTTIIOONN
+ <_f_c_n_t_l_._h> _i_n_t ooppeenn(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _i_n_t _f_l_a_g_s, _m_o_d_e___t _m_o_d_e)
+ <_s_y_s_/_t_y_p_e_s_._h> <_u_n_i_s_t_d_._h> _i_n_t dduupp(_i_n_t _o_l_d_d) _s_s_i_z_e___t wwrriittee(_i_n_t _d, _c_o_n_s_t
+ _v_o_i_d _*_b_u_f, _s_i_z_e___t _n_b_y_t_e_s)
+
OpenBSD June 6, 2010 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile
index ce5b7afc7e7..bbc61f82c50 100644
--- a/regress/usr.bin/mandoc/mdoc/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Makefile
@@ -1,8 +1,8 @@
-# $OpenBSD: Makefile,v 1.19 2012/07/08 16:50:36 schwarze Exp $
+# $OpenBSD: Makefile,v 1.20 2012/07/08 18:38:07 schwarze Exp $
SUBDIR += Ad An Ap Aq Ar At Bd Bk Bl Brq Bx Cd Cm D1 Dl Dq Dv Er Ev Fl Fo
SUBDIR += Ic In Lb Li Ms Mt Nd Nm No Ns Oo Op Ox Pf Pp Qq Rs
-SUBDIR += Sm Sq St Sx Sy Tn Ux Vt Xr blank
+SUBDIR += Sm Sq St Sx Sy Tn Ux Va Vt Xr blank
# disabled, mandoc must be fixed:
# Pa
diff --git a/regress/usr.bin/mandoc/mdoc/Va/Makefile b/regress/usr.bin/mandoc/mdoc/Va/Makefile
new file mode 100644
index 00000000000..a2d48cd8c19
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Va/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2012/07/08 18:38:07 schwarze Exp $
+
+REGRESS_TARGETS = basic
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Va/basic.in b/regress/usr.bin/mandoc/mdoc/Va/basic.in
new file mode 100644
index 00000000000..5ce4718a71e
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Va/basic.in
@@ -0,0 +1,14 @@
+.Dd July 8, 2012
+.Dt VA-BASIC 1
+.Os OpenBSD
+.Sh NAME
+.Nm Va-basic
+.Nd basic usage of the variable name macro
+.Sh DESCRIPTION
+Both
+.Vt char *
+.Va malloc_options
+and
+.Vt int
+.Va errno
+are typical examples of global variables.
diff --git a/regress/usr.bin/mandoc/mdoc/Va/basic.out_ascii b/regress/usr.bin/mandoc/mdoc/Va/basic.out_ascii
new file mode 100644
index 00000000000..d7bbe539dab
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Va/basic.out_ascii
@@ -0,0 +1,10 @@
+VA-BASIC(1) OpenBSD Reference Manual VA-BASIC(1)
+
+NNAAMMEE
+ VVaa--bbaassiicc - basic usage of the variable name macro
+
+DDEESSCCRRIIPPTTIIOONN
+ Both _c_h_a_r _* _m_a_l_l_o_c___o_p_t_i_o_n_s and _i_n_t _e_r_r_n_o are typical examples of global
+ variables.
+
+OpenBSD July 8, 2012 OpenBSD
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 7fb308aae29..0085bdf020b 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.20 2012/07/08 16:50:36 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.21 2012/07/08 18:38:07 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -63,6 +63,7 @@ static int pre_enc(DECL_ARGS);
static int pre_fa(DECL_ARGS);
static int pre_fn(DECL_ARGS);
static int pre_fo(DECL_ARGS);
+static int pre_ft(DECL_ARGS);
static int pre_in(DECL_ARGS);
static int pre_it(DECL_ARGS);
static int pre_nm(DECL_ARGS);
@@ -71,6 +72,7 @@ static int pre_pp(DECL_ARGS);
static int pre_sm(DECL_ARGS);
static int pre_sp(DECL_ARGS);
static int pre_sect(DECL_ARGS);
+static void pre_syn(const struct mdoc_node *);
static int pre_vt(DECL_ARGS);
static int pre_ux(DECL_ARGS);
static int pre_xr(DECL_ARGS);
@@ -108,7 +110,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ NULL, NULL, NULL, NULL, NULL }, /* _Fd */
{ NULL, pre_enc, post_enc, "\\fB-", "\\fP" }, /* Fl */
{ NULL, pre_fn, post_fn, NULL, NULL }, /* Fn */
- { NULL, pre_enc, post_enc, "\\fI", "\\fP" }, /* Ft */
+ { NULL, pre_ft, post_enc, NULL, "\\fP" }, /* Ft */
{ NULL, pre_enc, post_enc, "\\fB", "\\fP" }, /* Ic */
{ NULL, pre_in, post_in, NULL, NULL }, /* In */
{ NULL, pre_enc, post_enc, "\\fR", "\\fP" }, /* Li */
@@ -484,6 +486,46 @@ post_sect(DECL_ARGS)
outflags &= ~(MMAN_An_split | MMAN_An_nosplit);
}
+/* See mdoc_term.c, synopsis_pre() for comments. */
+static void
+pre_syn(const struct mdoc_node *n)
+{
+
+ if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags))
+ return;
+
+ if (n->prev->tok == n->tok &&
+ MDOC_Ft != n->tok &&
+ MDOC_Fo != n->tok &&
+ MDOC_Fn != n->tok) {
+ outflags |= MMAN_br;
+ return;
+ }
+
+ switch (n->prev->tok) {
+ case (MDOC_Fd):
+ /* FALLTHROUGH */
+ case (MDOC_Fn):
+ /* FALLTHROUGH */
+ case (MDOC_Fo):
+ /* FALLTHROUGH */
+ case (MDOC_In):
+ /* FALLTHROUGH */
+ case (MDOC_Vt):
+ outflags |= MMAN_sp;
+ break;
+ case (MDOC_Ft):
+ if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
+ outflags |= MMAN_sp;
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ outflags |= MMAN_br;
+ break;
+ }
+}
+
static int
pre_an(DECL_ARGS)
{
@@ -650,12 +692,12 @@ static int
pre_fn(DECL_ARGS)
{
+ pre_syn(n);
+
n = n->child;
if (NULL == n)
return(0);
- if (MDOC_SYNPRETTY & n->flags)
- outflags |= MMAN_br;
print_word("\\fB");
outflags &= ~MMAN_spc;
print_node(m, n);
@@ -681,9 +723,10 @@ pre_fo(DECL_ARGS)
{
switch (n->type) {
+ case (MDOC_BLOCK):
+ pre_syn(n);
+ break;
case (MDOC_HEAD):
- if (MDOC_SYNPRETTY & n->flags)
- outflags |= MMAN_br;
print_word("\\fB");
outflags &= ~MMAN_spc;
break;
@@ -716,11 +759,21 @@ post_fo(DECL_ARGS)
}
static int
+pre_ft(DECL_ARGS)
+{
+
+ pre_syn(n);
+ print_word("\\fI");
+ outflags &= ~MMAN_spc;
+ return(1);
+}
+
+static int
pre_in(DECL_ARGS)
{
if (MDOC_SYNPRETTY & n->flags) {
- outflags |= MMAN_br;
+ pre_syn(n);
print_word("\\fB#include <");
} else
print_word("<\\fI");
@@ -777,10 +830,12 @@ static int
pre_nm(DECL_ARGS)
{
+ if (MDOC_BLOCK == n->type)
+ pre_syn(n);
if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
return(1);
- if (MDOC_SYNPRETTY & n->flags)
- outflags |= MMAN_br;
+ if (NULL == n->child && NULL == m->name)
+ return(0);
print_word("\\fB");
outflags &= ~MMAN_spc;
if (NULL == n->child)
@@ -861,13 +916,13 @@ pre_vt(DECL_ARGS)
if (MDOC_SYNPRETTY & n->flags) {
switch (n->type) {
case (MDOC_BLOCK):
+ pre_syn(n);
return(1);
case (MDOC_BODY):
break;
default:
return(0);
}
- outflags |= MMAN_br;
}
print_word("\\fI");
outflags &= ~MMAN_spc;
@@ -883,8 +938,6 @@ post_vt(DECL_ARGS)
outflags &= ~MMAN_spc;
print_word("\\fP");
- if (MDOC_SYNPRETTY & n->flags)
- outflags |= MMAN_br;
}
static int