summaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-22 23:03:15 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-22 23:03:15 +0000
commit4dde5d7bbdceeec0032e163e7a8e8cac3233d659 (patch)
treec504c0e1f43a060e8f30fc4b2dcfcd6c62afc083 /man_term.c
parent2764eb0999f7c7e2835d85c1b9b44e5fa1f6f6c2 (diff)
downloadmandoc-4dde5d7bbdceeec0032e163e7a8e8cac3233d659.tar.gz
mandoc-4dde5d7bbdceeec0032e163e7a8e8cac3233d659.tar.zst
mandoc-4dde5d7bbdceeec0032e163e7a8e8cac3233d659.zip
Added `in' macro support for -man -Tascii. This is not yet supported in
-Thtml (I'm surprised to note that neither is LITERAL mode).
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/man_term.c b/man_term.c
index 9b7cb7ea..685e53a6 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.82 2010/07/22 13:47:50 kristaps Exp $ */
+/* $Id: man_term.c,v 1.83 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -94,6 +94,7 @@ static int pre_SS(DECL_ARGS);
static int pre_TP(DECL_ARGS);
static int pre_fi(DECL_ARGS);
static int pre_ign(DECL_ARGS);
+static int pre_in(DECL_ARGS);
static int pre_nf(DECL_ARGS);
static int pre_sp(DECL_ARGS);
@@ -141,6 +142,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_nf, NULL, 0 }, /* Vb */
{ pre_fi, NULL, 0 }, /* Ve */
{ pre_ign, NULL, 0 }, /* AT */
+ { pre_in, NULL, MAN_NOTEXT }, /* in */
};
@@ -354,6 +356,47 @@ pre_B(DECL_ARGS)
/* ARGSUSED */
static int
+pre_in(DECL_ARGS)
+{
+ int len, less;
+ size_t v;
+ const char *cp;
+
+ term_newln(p);
+
+ if (NULL == n->child) {
+ p->offset = mt->offset;
+ return(0);
+ }
+
+ cp = n->child->string;
+ less = 0;
+
+ if ('-' == *cp)
+ less = -1;
+ else if ('+' == *cp)
+ less = 1;
+ else
+ cp--;
+
+ if ((len = a2width(p, ++cp)) < 0)
+ return(0);
+
+ v = (size_t)len;
+
+ if (less < 0)
+ p->offset -= p->offset > v ? v : p->offset;
+ else if (less > 0)
+ p->offset += v;
+ else
+ p->offset = v;
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
pre_sp(DECL_ARGS)
{
size_t i, len;