summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-07-09 23:52:48 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-07-09 23:52:48 +0000
commitf958233df3739f14d91315733b66111fa3f65734 (patch)
treed0452d640fb4742e62cee2a1fae8cedbff7d8eac
parentaaa283f0e234e4de20eabbab273be7fb0ed32873 (diff)
fix -Tascii .Fd line breaking
and implement -Tman .Fd
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fd/Makefile5
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fd/break.in26
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fd/break.out_ascii27
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fd/font.in10
-rw-r--r--regress/usr.bin/mandoc/mdoc/Fd/font.out_ascii10
-rw-r--r--regress/usr.bin/mandoc/mdoc/Makefile7
-rw-r--r--usr.bin/mandoc/mdoc_man.c27
-rw-r--r--usr.bin/mandoc/mdoc_term.c30
8 files changed, 119 insertions, 23 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Fd/Makefile b/regress/usr.bin/mandoc/mdoc/Fd/Makefile
new file mode 100644
index 00000000000..aebcffbadd8
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fd/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2012/07/09 23:52:47 schwarze Exp $
+
+REGRESS_TARGETS = break font
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Fd/break.in b/regress/usr.bin/mandoc/mdoc/Fd/break.in
new file mode 100644
index 00000000000..e6fd9023a12
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fd/break.in
@@ -0,0 +1,26 @@
+.Dd June 9, 2010
+.Dt FD-BREAK 2
+.Os OpenBSD
+.Sh NAME
+.Nm Fd-break
+.Nd line break before old-style header include file
+.Sh SYNOPSIS
+.Fd #include <fcntl.h>
+.Ft int
+.Fn open "const char *path" "int flags" "mode_t mode"
+.Fd #include <sys/types.h>
+.Fd #include <unistd.h>
+.Ft int
+.Fn dup "int oldd"
+.Ft ssize_t
+.Fn write "int d" "const void *buf" "size_t nbytes"
+.Sh DESCRIPTION
+.Fd #include <fcntl.h>
+.Ft int
+.Fn open "const char *path" "int flags" "mode_t mode"
+.Fd #include <sys/types.h>
+.Fd #include <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/Fd/break.out_ascii b/regress/usr.bin/mandoc/mdoc/Fd/break.out_ascii
new file mode 100644
index 00000000000..81cbc1336bf
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fd/break.out_ascii
@@ -0,0 +1,27 @@
+FD-BREAK(2) OpenBSD Programmer's Manual FD-BREAK(2)
+
+NNAAMMEE
+ FFdd--bbrreeaakk - line break before old-style header include file
+
+SSYYNNOOPPSSIISS
+ ##iinncclluuddee <<ffccnnttll..hh>>
+
+ _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);
+
+ ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
+ ##iinncclluuddee <<uunniissttdd..hh>>
+
+ _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);
+
+DDEESSCCRRIIPPTTIIOONN
+ ##iinncclluuddee <<ffccnnttll..hh>>
+ _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) ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
+ ##iinncclluuddee <<uunniissttdd..hh>>
+ _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 9, 2010 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Fd/font.in b/regress/usr.bin/mandoc/mdoc/Fd/font.in
new file mode 100644
index 00000000000..a3a0a830e0b
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fd/font.in
@@ -0,0 +1,10 @@
+.Dd July 9, 2012
+.Dt FD-FONT 2
+.Os OpenBSD
+.Sh NAME
+.Nm Fd-font
+.Nd changing the font inside the old-style include macro
+.Sh DESCRIPTION
+normal text
+.Fd prefix\\fIheader\\fPsuffix
+trailing text
diff --git a/regress/usr.bin/mandoc/mdoc/Fd/font.out_ascii b/regress/usr.bin/mandoc/mdoc/Fd/font.out_ascii
new file mode 100644
index 00000000000..84312b99a79
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Fd/font.out_ascii
@@ -0,0 +1,10 @@
+FD-FONT(2) OpenBSD Programmer's Manual FD-FONT(2)
+
+NNAAMMEE
+ FFdd--ffoonntt - changing the font inside the old-style include macro
+
+DDEESSCCRRIIPPTTIIOONN
+ normal text pprreeffiixx_h_e_a_d_e_rssuuffffiixx
+ trailing text
+
+OpenBSD July 9, 2012 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile
index 08dae938b95..2b614dad637 100644
--- a/regress/usr.bin/mandoc/mdoc/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Makefile
@@ -1,7 +1,8 @@
-# $OpenBSD: Makefile,v 1.23 2012/07/09 22:36:04 schwarze Exp $
+# $OpenBSD: Makefile,v 1.24 2012/07/09 23:52:47 schwarze Exp $
-SUBDIR += Ad An Ap Aq Ar At Bd Bk Bl Brq Bx Cd Cm D1 Dl Dq Dv Eo Er Ev Fl Fo
-SUBDIR += Ic In Lb Lk Li Ms Mt Nd Nm No Ns Oo Op Ox Pa Pf Pp Qq Rs
+SUBDIR += Ad An Ap Aq Ar At Bd Bk Bl Brq Bx Cd Cm
+SUBDIR += D1 Dl Dq Dv Eo Er Ev Fd Fl Fo Ic In Lb Lk Li
+SUBDIR += Ms Mt Nd Nm No Ns Oo Op Ox Pa Pf Pp Qq Rs
SUBDIR += Sm Sq St Sx Sy Tn Ux Va Vt Xr blank
ascii groff groff-clean obj-clean tman: _SUBDIRUSE
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index e5646d02dc5..005e7f632e4 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.26 2012/07/09 22:36:04 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.27 2012/07/09 23:52:47 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -46,6 +46,7 @@ static void post_dl(DECL_ARGS);
static void post_enc(DECL_ARGS);
static void post_eo(DECL_ARGS);
static void post_fa(DECL_ARGS);
+static void post_fd(DECL_ARGS);
static void post_fl(DECL_ARGS);
static void post_fn(DECL_ARGS);
static void post_fo(DECL_ARGS);
@@ -69,6 +70,7 @@ static int pre_dl(DECL_ARGS);
static int pre_enc(DECL_ARGS);
static int pre_em(DECL_ARGS);
static int pre_fa(DECL_ARGS);
+static int pre_fd(DECL_ARGS);
static int pre_fl(DECL_ARGS);
static int pre_fn(DECL_ARGS);
static int pre_fo(DECL_ARGS);
@@ -120,7 +122,7 @@ static const struct manact manacts[MDOC_MAX + 1] = {
"\\fP\nutility exits 0 on success, and >0 if an error occurs."
}, /* Ex */
{ NULL, pre_fa, post_fa, NULL, NULL }, /* Fa */
- { NULL, NULL, NULL, NULL, NULL }, /* _Fd */
+ { NULL, pre_fd, post_fd, NULL, NULL }, /* Fd */
{ NULL, pre_fl, post_fl, NULL, NULL }, /* Fl */
{ NULL, pre_fn, post_fn, NULL, NULL }, /* Fn */
{ NULL, pre_ft, post_font, NULL, NULL }, /* Ft */
@@ -214,8 +216,8 @@ static const struct manact manacts[MDOC_MAX + 1] = {
{ cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */
{ NULL, NULL, NULL, NULL, NULL }, /* Brc */
{ NULL, NULL, NULL, NULL, NULL }, /* _%C */
- { NULL, NULL, NULL, NULL, NULL }, /* _Es */
- { NULL, NULL, NULL, NULL, NULL }, /* _En */
+ { NULL, NULL, NULL, NULL, NULL }, /* Es */
+ { NULL, NULL, NULL, NULL, NULL }, /* En */
{ NULL, pre_ux, NULL, "DragonFly", NULL }, /* Dx */
{ NULL, NULL, NULL, NULL, NULL }, /* _%Q */
{ NULL, pre_br, NULL, NULL, NULL }, /* br */
@@ -787,6 +789,23 @@ post_fa(DECL_ARGS)
}
static int
+pre_fd(DECL_ARGS)
+{
+
+ pre_syn(n);
+ font_push('B');
+ return(1);
+}
+
+static void
+post_fd(DECL_ARGS)
+{
+
+ font_pop();
+ outflags |= MMAN_br;
+}
+
+static int
pre_fl(DECL_ARGS)
{
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 4f724dadf2c..a41ce181264 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.142 2012/07/08 22:48:38 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.143 2012/07/09 23:52:47 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -65,7 +65,7 @@ static void termp_an_post(DECL_ARGS);
static void termp_bd_post(DECL_ARGS);
static void termp_bk_post(DECL_ARGS);
static void termp_bl_post(DECL_ARGS);
-static void termp_d1_post(DECL_ARGS);
+static void termp_fd_post(DECL_ARGS);
static void termp_fo_post(DECL_ARGS);
static void termp_in_post(DECL_ARGS);
static void termp_it_post(DECL_ARGS);
@@ -125,8 +125,8 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_sh_pre, termp_sh_post }, /* Sh */
{ termp_ss_pre, termp_ss_post }, /* Ss */
{ termp_sp_pre, NULL }, /* Pp */
- { termp_d1_pre, termp_d1_post }, /* D1 */
- { termp_d1_pre, termp_d1_post }, /* Dl */
+ { termp_d1_pre, termp_bl_post }, /* D1 */
+ { termp_d1_pre, termp_bl_post }, /* Dl */
{ termp_bd_pre, termp_bd_post }, /* Bd */
{ NULL, NULL }, /* Ed */
{ termp_bl_pre, termp_bl_post }, /* Bl */
@@ -142,7 +142,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* Ev */
{ termp_ex_pre, NULL }, /* Ex */
{ termp_fa_pre, NULL }, /* Fa */
- { termp_fd_pre, NULL }, /* Fd */
+ { termp_fd_pre, termp_fd_post }, /* Fd */
{ termp_fl_pre, NULL }, /* Fl */
{ termp_fn_pre, NULL }, /* Fn */
{ termp_ft_pre, NULL }, /* Ft */
@@ -1403,6 +1403,15 @@ termp_fd_pre(DECL_ARGS)
/* ARGSUSED */
+static void
+termp_fd_post(DECL_ARGS)
+{
+
+ term_newln(p);
+}
+
+
+/* ARGSUSED */
static int
termp_sh_pre(DECL_ARGS)
{
@@ -1496,17 +1505,6 @@ termp_d1_pre(DECL_ARGS)
/* ARGSUSED */
-static void
-termp_d1_post(DECL_ARGS)
-{
-
- if (MDOC_BLOCK != n->type)
- return;
- term_newln(p);
-}
-
-
-/* ARGSUSED */
static int
termp_ft_pre(DECL_ARGS)
{