summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-12-19 12:10:34 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-12-19 12:10:34 +0000
commit33f2974d553e965033ec550a4599b29621e881b8 (patch)
treedb958fdb28313f56140bb5a2cbe65eb57e14c727
parente3f79ad526b63b3fa970a2d27322ecbececc6004 (diff)
Handle .Bk the same way as groff 1.20.1:
.Bk without arguments defaults to -words. .Bk with invalid arguments (including -lines) has no effect. ok kristaps@
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bk/Makefile6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bk/badarg.in51
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bk/badarg.out_ascii21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bk/break.in24
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii12
-rw-r--r--regress/usr.bin/mandoc/mdoc/Makefile4
-rw-r--r--usr.bin/mandoc/mdoc_term.c5
7 files changed, 119 insertions, 4 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bk/Makefile b/regress/usr.bin/mandoc/mdoc/Bk/Makefile
new file mode 100644
index 00000000000..387df3ea05e
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bk/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2010/12/19 12:10:33 schwarze Exp $
+
+REGRESS_TARGETS=break badarg
+GROFF_TARGETS=break badarg
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/mdoc/Bk/badarg.in b/regress/usr.bin/mandoc/mdoc/Bk/badarg.in
new file mode 100644
index 00000000000..426f8318c0e
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bk/badarg.in
@@ -0,0 +1,51 @@
+.Dd June 30, 2010
+.Dt BK-BADARG 1
+.Os
+.Sh NAME
+.Nm Bk-badarg
+.Nd bad arguments after Bk
+.Sh SYNOPSIS
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Bk -badarg
+.Op o Ar a
+.Ek
+.Pp
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Bk -lines
+.Op o Ar a
+.Ek
+.Pp
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Bk -line
+.Op o Ar a
+.Ek
+.Pp
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Bk
+.Op o Ar a
+.Ek
+.Pp
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Bk -words -murks
+.Op o Ar a
+.Ek
diff --git a/regress/usr.bin/mandoc/mdoc/Bk/badarg.out_ascii b/regress/usr.bin/mandoc/mdoc/Bk/badarg.out_ascii
new file mode 100644
index 00000000000..c1db931bf62
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bk/badarg.out_ascii
@@ -0,0 +1,21 @@
+BK-BADARG(1) OpenBSD Reference Manual BK-BADARG(1)
+
+NNAAMMEE
+ BBkk--bbaaddaarrgg - bad arguments after Bk
+
+SSYYNNOOPPSSIISS
+ BBkk--bbaaddaarrgg _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
+ BBkk--bbaaddaarrgg _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
+ BBkk--bbaaddaarrgg _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
+ BBkk--bbaaddaarrgg _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
+ BBkk--bbaaddaarrgg _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
diff --git a/regress/usr.bin/mandoc/mdoc/Bk/break.in b/regress/usr.bin/mandoc/mdoc/Bk/break.in
new file mode 100644
index 00000000000..de2038436a2
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bk/break.in
@@ -0,0 +1,24 @@
+.Dd June 30, 2010
+.Dt BK-BREAK 1
+.Os
+.Sh NAME
+.Nm Bk-break
+.Nd handling of word keeps
+.Sh DESCRIPTION
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Bk -words
+.Op o Ar a
+.Ek
+.Pp
+.Bk -words
+.Nm
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x x x
+.Ar x x x x x x
+.Op o Ar a
+.Ek
diff --git a/regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii b/regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii
new file mode 100644
index 00000000000..04bafbcccdd
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bk/break.out_ascii
@@ -0,0 +1,12 @@
+BK-BREAK(1) OpenBSD Reference Manual BK-BREAK(1)
+
+NNAAMMEE
+ BBkk--bbrreeaakk - handling of word keeps
+
+DDEESSCCRRIIPPTTIIOONN
+ BBkk--bbrreeaakk _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
+ BBkk--bbrreeaakk _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x _x
+ [o _a]
+
diff --git a/regress/usr.bin/mandoc/mdoc/Makefile b/regress/usr.bin/mandoc/mdoc/Makefile
index ef653f748cd..a480b603b6b 100644
--- a/regress/usr.bin/mandoc/mdoc/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.9 2010/12/04 14:49:40 schwarze Exp $
+# $OpenBSD: Makefile,v 1.10 2010/12/19 12:10:33 schwarze Exp $
-SUBDIR+= Ar At Bd Bl Fl Fo In Lb Li Mt Nm Op Rs Sm Xr
+SUBDIR+= Ar At Bd Bk Bl Fl Fo In Lb Li Mt Nm Op Rs Sm Xr
SUBDIR+= blank
# disabled, mandoc must be fixed:
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 65ceb6dd068..d80a4880de8 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.116 2010/12/11 14:29:56 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.117 2010/12/19 12:10:33 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -2137,7 +2137,8 @@ termp_bk_pre(DECL_ARGS)
case (MDOC_HEAD):
return(0);
case (MDOC_BODY):
- p->flags |= TERMP_PREKEEP;
+ if (n->parent->args || 0 == n->prev->nchild)
+ p->flags |= TERMP_PREKEEP;
break;
default:
abort();