summaryrefslogtreecommitdiffstatshomepage
path: root/action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-05 13:12:12 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-05 13:12:12 +0000
commit74accf0fc23a61d1716812e017394125f5257020 (patch)
tree78d7edfbcd8c74701fc68788b3b58538353c90c8 /action.c
parent6f9d9cf4d38fa9a821a61f50e3ee7caa2306cdb5 (diff)
downloadmandoc-74accf0fc23a61d1716812e017394125f5257020.tar.gz
mandoc-74accf0fc23a61d1716812e017394125f5257020.tar.zst
mandoc-74accf0fc23a61d1716812e017394125f5257020.zip
Cleaned up ctype functions (netbsd).
Fixed .Ex/.Rv -std usage. Made Ar provide default value.
Diffstat (limited to 'action.c')
-rw-r--r--action.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/action.c b/action.c
index 1b4f157d..84a3ad8f 100644
--- a/action.c
+++ b/action.c
@@ -1,4 +1,4 @@
-/* $Id: action.c,v 1.29 2009/03/05 12:08:53 kristaps Exp $ */
+/* $Id: action.c,v 1.30 2009/03/05 13:12:12 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -36,15 +36,16 @@ struct actions {
/* Per-macro action routines. */
+static int post_ar(struct mdoc *);
static int post_bl(struct mdoc *);
static int post_bl_width(struct mdoc *);
static int post_bl_tagwidth(struct mdoc *);
static int post_dd(struct mdoc *);
static int post_dt(struct mdoc *);
-static int post_ex(struct mdoc *);
static int post_nm(struct mdoc *);
static int post_os(struct mdoc *);
static int post_sh(struct mdoc *);
+static int post_ex(struct mdoc *);
static int post_prologue(struct mdoc *);
@@ -67,7 +68,7 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL }, /* It */
{ NULL }, /* Ad */
{ NULL }, /* An */
- { NULL }, /* Ar */
+ { post_ar }, /* Ar */
{ NULL }, /* Cd */
{ NULL }, /* Cm */
{ NULL }, /* Dv */
@@ -171,14 +172,10 @@ post_ex(struct mdoc *mdoc)
if (0 == mdoc->last->data.elem.argc)
return(1);
-
- assert(1 == mdoc->last->data.elem.argc);
- if (1 == mdoc->last->data.elem.argv[0].sz)
+ if (mdoc->last->data.elem.argv[0].sz)
return(1);
- assert(0 == mdoc->last->data.elem.argv[0].sz);
- if (NULL == mdoc->meta.name)
- return(mdoc_err(mdoc, "default name not yet set"));
+ assert(mdoc->meta.name);
mdoc_msg(mdoc, "writing %s argument: %s",
mdoc_argnames[MDOC_Std], mdoc->meta.name);
@@ -484,6 +481,29 @@ post_bl(struct mdoc *mdoc)
static int
+post_ar(struct mdoc *mdoc)
+{
+ struct mdoc_node *n;
+
+ if (mdoc->last->child)
+ return(1);
+
+ n = mdoc->last;
+
+ mdoc->next = MDOC_NEXT_CHILD;
+ mdoc_word_alloc(mdoc, mdoc->last->line,
+ mdoc->last->pos, "file");
+ mdoc->next = MDOC_NEXT_SIBLING;
+ mdoc_word_alloc(mdoc, mdoc->last->line,
+ mdoc->last->pos, "...");
+
+ mdoc->last = n;
+ mdoc->next = MDOC_NEXT_SIBLING;
+ return(1);
+}
+
+
+static int
post_dd(struct mdoc *mdoc)
{
char buf[64];