diff options
-rw-r--r-- | man.7 | 11 | ||||
-rw-r--r-- | man.c | 1 | ||||
-rw-r--r-- | man.h | 1 | ||||
-rw-r--r-- | man_action.c | 1 | ||||
-rw-r--r-- | man_html.c | 1 | ||||
-rw-r--r-- | man_macro.c | 1 | ||||
-rw-r--r-- | man_term.c | 43 | ||||
-rw-r--r-- | man_validate.c | 9 | ||||
-rw-r--r-- | out.c | 1 |
9 files changed, 65 insertions, 4 deletions
@@ -427,6 +427,7 @@ The syntax is as follows: .It Sx \&br Ta 0 Ta current Ta compat .It Sx \&fi Ta 0 Ta current Ta compat .It Sx \&i Ta n Ta current Ta compat +.It Sx \&in Ta 1 Ta current Ta compat .It Sx \&na Ta 0 Ta current Ta compat .It Sx \&nf Ta 0 Ta current Ta compat .It Sx \&r Ta 0 Ta current Ta compat @@ -853,6 +854,16 @@ See also .Sx \&b , and .Sx \&r . +.Ss \&in +Indent relative to the current indentation: +.Pp +.D1 Pf \. Sx \&in Op Cm width +.Pp +If +.Cm width +is signed, the new offset is relative. +Otherwise, it is absolute. +This value is reset upon the next paragraph, section, or sub-section. .Ss \&na Don't align to the right margin. .Ss \&nf @@ -41,6 +41,7 @@ const char *const __man_macronames[MAN_MAX] = { "nf", "fi", "r", "RE", "RS", "DT", "UC", "PD", "Sp", "Vb", "Ve", "AT", + "in" }; const char * const *man_macronames = __man_macronames; @@ -56,6 +56,7 @@ enum mant { MAN_Vb, MAN_Ve, MAN_AT, + MAN_in, MAN_MAX }; diff --git a/man_action.c b/man_action.c index b388e66f..4ca0d5a9 100644 --- a/man_action.c +++ b/man_action.c @@ -73,6 +73,7 @@ const struct actions man_actions[MAN_MAX] = { { post_nf }, /* Vb */ { post_fi }, /* Ve */ { post_AT }, /* AT */ + { NULL }, /* in */ }; @@ -108,6 +108,7 @@ static const struct htmlman mans[MAN_MAX] = { { man_ign_pre, NULL }, /* Vb */ { NULL, NULL }, /* Ve */ { man_ign_pre, NULL }, /* AT */ + { man-in_pre, NULL }, /* in */ }; diff --git a/man_macro.c b/man_macro.c index abac5f84..a4bb6837 100644 --- a/man_macro.c +++ b/man_macro.c @@ -83,6 +83,7 @@ const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, 0 }, /* Vb */ { in_line_eoln, 0 }, /* Ve */ { in_line_eoln, 0 }, /* AT */ + { in_line_eoln, 0 }, /* in */ }; const struct man_macro * const man_macros = __man_macros; @@ -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; diff --git a/man_validate.c b/man_validate.c index 0d96953c..bc5a8c73 100644 --- a/man_validate.c +++ b/man_validate.c @@ -83,9 +83,9 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, NULL }, /* I */ { NULL, NULL }, /* IR */ { NULL, NULL }, /* RI */ - { NULL, posts_eq0 }, /* na */ + { NULL, posts_eq0 }, /* na */ /* FIXME: should warn only. */ { NULL, NULL }, /* i */ - { NULL, posts_le1 }, /* sp */ + { NULL, posts_le1 }, /* sp */ /* FIXME: should warn only. */ { pres_bline, posts_eq0 }, /* nf */ { pres_bline, posts_eq0 }, /* fi */ { NULL, NULL }, /* r */ @@ -94,10 +94,11 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, NULL }, /* DT */ { NULL, NULL }, /* UC */ { NULL, NULL }, /* PD */ - { NULL, posts_le1 }, /* Sp */ - { pres_bline, posts_le1 }, /* Vb */ + { NULL, posts_le1 }, /* Sp */ /* FIXME: should warn only. */ + { pres_bline, posts_le1 }, /* Vb */ /* FIXME: should warn only. */ { pres_bline, posts_eq0 }, /* Ve */ { NULL, NULL }, /* AT */ + { NULL, NULL }, /* in */ }; @@ -116,6 +116,7 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def) return(0); } + /* FIXME: do this in the caller. */ if ((dst->scale = atof(buf)) < 0) dst->scale = 0; dst->unit = unit; |