diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-07-12 20:24:24 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-07-12 20:24:24 +0000 |
commit | f564800eb22e4968fd18f741ca173e45ff1c8f93 (patch) | |
tree | 3351deadfff4b69c36db3d0955e7278ff863bfad /mdoc_action.c | |
parent | e9f5e91e7380411d0e64bbe973877e3b72acd928 (diff) | |
download | mandoc-f564800eb22e4968fd18f741ca173e45ff1c8f93.tar.gz |
Moved mdoc_a2att() into libmdoc (replacement happens in mdoc_action.c).
Diffstat (limited to 'mdoc_action.c')
-rw-r--r-- | mdoc_action.c | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/mdoc_action.c b/mdoc_action.c index 3babc5d1..5c880e2f 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -32,14 +32,12 @@ struct actions { int (*post)(POST_ARGS); }; -static int concat(struct mdoc *, const struct mdoc_node *, - char *, size_t); - static int post_ar(POST_ARGS); +static int post_at(POST_ARGS); static int post_bl(POST_ARGS); static int post_bl_head(POST_ARGS); -static int post_bl_width(POST_ARGS); static int post_bl_tagwidth(POST_ARGS); +static int post_bl_width(POST_ARGS); static int post_dd(POST_ARGS); static int post_display(POST_ARGS); static int post_dt(POST_ARGS); @@ -109,7 +107,7 @@ const struct actions mdoc_actions[MDOC_MAX] = { { NULL, NULL }, /* Ac */ { NULL, NULL }, /* Ao */ { NULL, NULL }, /* Aq */ - { NULL, NULL }, /* At */ + { NULL, post_at }, /* At */ { NULL, NULL }, /* Bc */ { NULL, NULL }, /* Bf */ { NULL, NULL }, /* Bo */ @@ -174,9 +172,11 @@ const struct actions mdoc_actions[MDOC_MAX] = { { NULL, NULL }, /* %Q */ }; +static int concat(struct mdoc *, const struct mdoc_node *, + char *, size_t); #ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); +extern size_t strlcat(char *, const char *, size_t); #endif @@ -290,6 +290,35 @@ post_nm(POST_ARGS) static int +post_at(POST_ARGS) +{ + struct mdoc_node *n; + const char *p; + + if (m->last->child) { + assert(MDOC_TEXT == m->last->child->type); + p = mdoc_a2att(m->last->child->string); + assert(p); + free(m->last->child->string); + m->last->child->string = strdup(p); + if (NULL == m->last->child->string) + return(mdoc_nerr(m, m->last, EMALLOC)); + return(1); + } + + n = m->last; + m->next = MDOC_NEXT_CHILD; + + if ( ! mdoc_word_alloc(m, n->line, n->pos, "AT&T UNIX")) + return(0); + + m->last = n; + m->next = MDOC_NEXT_SIBLING; + return(1); +} + + +static int post_sh(POST_ARGS) { enum mdoc_sec sec; @@ -667,8 +696,7 @@ post_lk(POST_ARGS) m->next = MDOC_NEXT_CHILD; /* XXX: this isn't documented anywhere! */ - if ( ! mdoc_word_alloc(m, m->last->line, - m->last->pos, "~")) + if ( ! mdoc_word_alloc(m, m->last->line, m->last->pos, "~")) return(0); m->last = n; @@ -687,12 +715,10 @@ post_ar(POST_ARGS) n = m->last; m->next = MDOC_NEXT_CHILD; - if ( ! mdoc_word_alloc(m, m->last->line, - m->last->pos, "file")) + if ( ! mdoc_word_alloc(m, m->last->line, m->last->pos, "file")) return(0); m->next = MDOC_NEXT_SIBLING; - if ( ! mdoc_word_alloc(m, m->last->line, - m->last->pos, "...")) + if ( ! mdoc_word_alloc(m, m->last->line, m->last->pos, "...")) return(0); m->last = n; |