summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-22 13:47:50 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-22 13:47:50 +0000
commit6517639ca42037e224f73f48f9fe1c1bfab97b6a (patch)
treee300a23e6c79993dd9985aad75f67ccc4a07eaae
parent802106a6f9d58bef3c98f97d404778e8f57c4406 (diff)
downloadmandoc-6517639ca42037e224f73f48f9fe1c1bfab97b6a.tar.gz
mandoc-6517639ca42037e224f73f48f9fe1c1bfab97b6a.tar.zst
mandoc-6517639ca42037e224f73f48f9fe1c1bfab97b6a.zip
Bring `sp', `Sp', and `br' behaviour for -man in line with how -mdoc's
is handled: correctly. This removes superfluous line breaks in many -man manuals.
-rw-r--r--man_term.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/man_term.c b/man_term.c
index 7e792be2..9b7cb7ea 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.81 2010/07/22 13:36:25 kristaps Exp $ */
+/* $Id: man_term.c,v 1.82 2010/07/22 13:47:50 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -92,7 +92,6 @@ static int pre_RS(DECL_ARGS);
static int pre_SH(DECL_ARGS);
static int pre_SS(DECL_ARGS);
static int pre_TP(DECL_ARGS);
-static int pre_br(DECL_ARGS);
static int pre_fi(DECL_ARGS);
static int pre_ign(DECL_ARGS);
static int pre_nf(DECL_ARGS);
@@ -106,7 +105,7 @@ static void post_SS(DECL_ARGS);
static void post_TP(DECL_ARGS);
static const struct termact termacts[MAN_MAX] = {
- { pre_br, NULL, MAN_NOTEXT }, /* br */
+ { pre_sp, NULL, MAN_NOTEXT }, /* br */
{ NULL, NULL, 0 }, /* TH */
{ pre_SH, post_SH, 0 }, /* SH */
{ pre_SS, post_SS, 0 }, /* SS */
@@ -359,12 +358,18 @@ pre_sp(DECL_ARGS)
{
size_t i, len;
- len = n->child ?
- a2height(p, n->child->string) : term_len(p, 1);
+ switch (n->tok) {
+ case (MAN_br):
+ len = 0;
+ break;
+ default:
+ len = n->child ? a2height(p, n->child->string) : 1;
+ break;
+ }
if (0 == len)
term_newln(p);
- for (i = 0; i <= len; i++)
+ for (i = 0; i < len; i++)
term_vspace(p);
return(0);
@@ -373,16 +378,6 @@ pre_sp(DECL_ARGS)
/* ARGSUSED */
static int
-pre_br(DECL_ARGS)
-{
-
- term_newln(p);
- return(0);
-}
-
-
-/* ARGSUSED */
-static int
pre_HP(DECL_ARGS)
{
size_t len;