* [PATCH] .Bk with invalid arguments
@ 2010-12-12 0:07 Ingo Schwarze
0 siblings, 0 replies; only message in thread
From: Ingo Schwarze @ 2010-12-12 0:07 UTC (permalink / raw)
To: tech
Hi,
while looking at some regression tests and trying to get them committed,
i noticed that .Bk behaves differently when given invalid arguments.
1. .Bk -words works the same with mandoc, old and new groff.
2. .Bk without any arg should default to -words
according to new groff.
3. .Bk with invalid args (or -lines) should have no effect
according to new groff.
The following mini-patch adjusts mandoc to do the same.
For now, -words is the only argument accepted by mandoc,
so to catch case 1, it's sufficient to check for any arguments
at all, and to catch 2, it's suffcient to check that the HEAD
has no children.
OK?
Index: mdoc_term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_term.c,v
retrieving revision 1.115
diff -u -p -r1.115 mdoc_term.c
--- mdoc_term.c 6 Dec 2010 22:10:13 -0000 1.115
+++ mdoc_term.c 11 Dec 2010 23:58:41 -0000
@@ -2124,7 +2124,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();
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-12 0:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-12 0:07 [PATCH] .Bk with invalid arguments Ingo Schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).