From 75c49a4fece7c409c4b5a3013a40f5f352eced01 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 30 Mar 2014 21:28:01 +0000 Subject: Support relative arguments to .ll (increase or decrease line length). --- term.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'term.c') diff --git a/term.c b/term.c index 158b7d14..29c4fcb8 100644 --- a/term.c +++ b/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.218 2014/03/23 11:25:26 schwarze Exp $ */ +/* $Id: term.c,v 1.219 2014/03/30 21:28:01 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze @@ -623,6 +623,36 @@ encode(struct termp *p, const char *word, size_t sz) } } +void +term_setwidth(struct termp *p, const char *wstr) +{ + struct roffsu su; + size_t width; + int iop; + + if (NULL != wstr) { + switch (*wstr) { + case ('+'): + iop = 1; + wstr++; + break; + case ('-'): + iop = -1; + wstr++; + break; + default: + iop = 0; + break; + } + if ( ! a2roffsu(wstr, &su, SCALE_MAX)) { + wstr = NULL; + iop = 0; + } + } + width = (NULL != wstr) ? term_hspan(p, &su) : 0; + (*p->setwidth)(p, iop, width); +} + size_t term_len(const struct termp *p, size_t sz) { -- cgit v1.2.3