-
- assert(m->meta.name);
-
- m->last->args->argv[0].value = calloc(1, sizeof(char *));
- if (NULL == m->last->args->argv[0].value)
- return(mdoc_nerr(m, m->last, EMALLOC));
-
- m->last->args->argv[0].sz = 1;
- m->last->args->argv[0].value[0] = strdup(m->meta.name);
- if (NULL == m->last->args->argv[0].value[0])
- return(mdoc_nerr(m, m->last, EMALLOC));
-
- return(1);
-}
-
-
-static int
-post_nm(POST_ARGS)
-{
- char buf[64];
-
- if (m->meta.name)
- return(1);
-
- buf[0] = 0;
- if ( ! concat(m, m->last->child, buf, sizeof(buf)))
- return(0);
-
- if (NULL == (m->meta.name = strdup(buf)))
- return(mdoc_nerr(m, m->last, EMALLOC));
-
- return(1);
-}
-
-
-static int
-post_lb(POST_ARGS)
-{
- const char *p;
- char *buf;
- size_t sz;
-
- /*
- * FIXME: this must be broken apart into a series of TEXT nodes,
- * each containing a single word.
- */
-
- assert(MDOC_TEXT == m->last->child->type);
- p = mdoc_a2lib(m->last->child->string);
- if (NULL == p) {
- sz = strlen(m->last->child->string) +
- 2 + strlen("\\(lqlibrary\\(rq");
- buf = malloc(sz);
- if (NULL == buf)
- return(mdoc_nerr(m, m->last, EMALLOC));
- (void)snprintf(buf, sz, "library \\(lq%s\\(rq",
- m->last->child->string);
- free(m->last->child->string);
- m->last->child->string = buf;
- return(1);
- }
-
- 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);
-}
-
-
-static int
-post_st(POST_ARGS)
-{
- const char *p;
-
- /*
- * FIXME: this must be broken apart into a series of TEXT nodes,
- * each containing a single word.
- */
-
- assert(MDOC_TEXT == m->last->child->type);
- p = mdoc_a2st(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);
-}
-
-
-static int
-post_at(POST_ARGS)
-{
- struct mdoc_node *n;
- const char *p;
-
- /*
- * FIXME: this must be broken apart into a series of TEXT nodes,
- * each containing a single word.
- */
-
- 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;