summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-20 13:22:48 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-20 13:22:48 +0000
commite1705017f36f9b6ace72ca94ca546e984e919b18 (patch)
tree4c61c2efc3ba7879b3f98840d3df2236a615a6bd /mdoc_term.c
parentc3829fc88899838b68249bab2a47f14c64d611f4 (diff)
downloadmandoc-e1705017f36f9b6ace72ca94ca546e984e919b18.tar.gz
mandoc-e1705017f36f9b6ace72ca94ca546e984e919b18.tar.zst
mandoc-e1705017f36f9b6ace72ca94ca546e984e919b18.zip
Updated manual structure in mdoc.7.
Synchronised mdoc.template and mdoc.7 manual structure. `Rv' and `Ex' now accept multiple arguments (-std made standalone, terms as children). `Rv' and `Ex' format correctly in -Tascii (plurals, commas, etc.).
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c72
1 files changed, 48 insertions, 24 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index e9fd55ff..2bd7cd2f 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.67 2009/08/19 14:45:56 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.68 2009/08/20 13:22:48 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1237,23 +1237,33 @@ termp_rs_pre(DECL_ARGS)
static int
termp_rv_pre(DECL_ARGS)
{
- int i;
-
- i = arg_getattr(MDOC_Std, node);
- assert(-1 != i);
- assert(node->args->argv[i].sz);
+ const struct mdoc_node *nn;
term_newln(p);
term_word(p, "The");
- p->flags |= ttypes[TTYPE_FUNC_NAME];
- term_word(p, *node->args->argv[i].value);
- p->flags &= ~ttypes[TTYPE_FUNC_NAME];
- p->flags |= TERMP_NOSPACE;
+ nn = node->child;
+ assert(nn);
+ for ( ; nn; nn = nn->next) {
+ p->flags |= ttypes[TTYPE_FUNC_NAME];
+ term_word(p, nn->string);
+ p->flags &= ~ttypes[TTYPE_FUNC_NAME];
+ p->flags |= TERMP_NOSPACE;
+ if (nn->next && NULL == nn->next->next)
+ term_word(p, "(), and");
+ else if (nn->next)
+ term_word(p, "(),");
+ else
+ term_word(p, "()");
+ }
+
+ if (node->child->next)
+ term_word(p, "functions return");
+ else
+ term_word(p, "function returns");
- term_word(p, "() function returns the value 0 if successful;");
- term_word(p, "otherwise the value -1 is returned and the");
- term_word(p, "global variable");
+ term_word(p, "the value 0 if successful; otherwise the value "
+ "-1 is returned and the global variable");
p->flags |= ttypes[TTYPE_VAR_DECL];
term_word(p, "errno");
@@ -1261,7 +1271,7 @@ termp_rv_pre(DECL_ARGS)
term_word(p, "is set to indicate the error.");
- return(1);
+ return(0);
}
@@ -1269,19 +1279,33 @@ termp_rv_pre(DECL_ARGS)
static int
termp_ex_pre(DECL_ARGS)
{
- int i;
-
- i = arg_getattr(MDOC_Std, node);
- assert(-1 != i);
- assert(node->args->argv[i].sz);
+ const struct mdoc_node *nn;
term_word(p, "The");
- p->flags |= ttypes[TTYPE_PROG];
- term_word(p, *node->args->argv[i].value);
- p->flags &= ~ttypes[TTYPE_PROG];
- term_word(p, "utility exits 0 on success, and >0 if an error occurs.");
- return(1);
+ nn = node->child;
+ assert(nn);
+ for ( ; nn; nn = nn->next) {
+ p->flags |= ttypes[TTYPE_PROG];
+ term_word(p, nn->string);
+ p->flags &= ~ttypes[TTYPE_PROG];
+ p->flags |= TERMP_NOSPACE;
+ if (nn->next && NULL == nn->next->next)
+ term_word(p, ", and");
+ else if (nn->next)
+ term_word(p, ",");
+ else
+ p->flags &= ~TERMP_NOSPACE;
+ }
+
+ if (node->child->next)
+ term_word(p, "utilities exit");
+ else
+ term_word(p, "utility exits");
+
+ term_word(p, "0 on success, and >0 if an error occurs.");
+
+ return(0);
}