summaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-18 19:03:36 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-18 19:03:36 +0000
commitaae27a21d3c4cec6e6fabd12fb23027c5ef5f244 (patch)
tree7506c9be8ca503ee5629e83925232b4c93a140e7 /man_term.c
parent8b811fac9808f46457e2e037bbd37d0e07ea798d (diff)
downloadmandoc-aae27a21d3c4cec6e6fabd12fb23027c5ef5f244.tar.gz
mandoc-aae27a21d3c4cec6e6fabd12fb23027c5ef5f244.tar.zst
mandoc-aae27a21d3c4cec6e6fabd12fb23027c5ef5f244.zip
Made sure devices and formats recognise that -man and -mdoc have different syntax for scaling widths: -mdoc assumes no unit means that the value is a string literal while -man instead uses the default vertical/horizontal scale.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/man_term.c b/man_term.c
index 7010ccd4..48a6f9c4 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.39 2009/10/18 13:34:16 kristaps Exp $ */
+/* $Id: man_term.c,v 1.40 2009/10/18 19:03:37 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <string.h>
+#include "out.h"
#include "man.h"
#include "term.h"
#include "chars.h"
@@ -183,25 +184,28 @@ terminal_man(void *arg, const struct man *man)
static int
arg2height(const struct man_node *n)
{
- int r;
+ struct roffsu su;
assert(MAN_TEXT == n->type);
assert(n->string);
+ if ( ! a2roffsu(n->string, &su, SCALE_VS))
+ SCALE_VS_INIT(&su, strlen(n->string));
- if ((r = a2height(n->string)) < 0)
- return(1);
-
- return(r);
+ return(term_vspan(&su));
}
static int
arg2width(const struct man_node *n)
{
+ struct roffsu su;
assert(MAN_TEXT == n->type);
assert(n->string);
- return(a2width(n->string));
+ if ( ! a2roffsu(n->string, &su, SCALE_BU))
+ SCALE_HS_INIT(&su, strlen(n->string) + 2);
+
+ return(term_hspan(&su));
}