From bcec2b4c360e4413e32271bf3014fd92b5b328b0 Mon Sep 17 00:00:00 2001 From: schwarze Date: Tue, 23 Dec 2014 01:57:11 +0000 Subject: [PATCH] correctly handle scaling units after .PD --- regress/usr.bin/mandoc/man/PD/args.in | 13 +++++++++---- regress/usr.bin/mandoc/man/PD/args.out_ascii | 7 +++++++ usr.bin/mandoc/man_term.c | 8 +++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/regress/usr.bin/mandoc/man/PD/args.in b/regress/usr.bin/mandoc/man/PD/args.in index 9fb166c87ea..df344a1a9b2 100644 --- a/regress/usr.bin/mandoc/man/PD/args.in +++ b/regress/usr.bin/mandoc/man/PD/args.in @@ -14,10 +14,15 @@ no argument at all .PD 2v .PP argument(2v) -.\" also test (2cm) -.\" .PD xxx -.\" .PP -.\" argument(xxx) +.PD 2p +.PP +argument(2p) +.PD 1c +.PP +argument(1c) +.PD xxx +.PP +argument(xxx) .PD 0 zzz .PP excessive argument diff --git a/regress/usr.bin/mandoc/man/PD/args.out_ascii b/regress/usr.bin/mandoc/man/PD/args.out_ascii index 802c6cb6e7d..e0bb2f18261 100644 --- a/regress/usr.bin/mandoc/man/PD/args.out_ascii +++ b/regress/usr.bin/mandoc/man/PD/args.out_ascii @@ -17,6 +17,13 @@ DDEESSCCRRIIPPTTIIOONN argument(2v) + argument(2p) + + + argument(1c) + + + argument(xxx) excessive argument diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index b7ead70a122..a27a287ae45 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.112 2014/12/04 02:05:16 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.113 2014/12/23 01:57:11 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -286,14 +286,16 @@ pre_literal(DECL_ARGS) static int pre_PD(DECL_ARGS) { + struct roffsu su; n = n->child; - if (0 == n) { + if (n == NULL) { mt->pardist = 1; return(0); } assert(MAN_TEXT == n->type); - mt->pardist = atoi(n->string); + if (a2roffsu(n->string, &su, SCALE_VS)) + mt->pardist = term_vspan(p, &su); return(0); } -- 2.20.1