summaryrefslogtreecommitdiffstats
path: root/mdoc_action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-12 20:50:08 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-12 20:50:08 +0000
commitc13cf29fb280ec0bdd7e124d786f95c82f3e2c71 (patch)
tree13b84acd5935bc9ef1ec19bc12454c9e5f8a3d04 /mdoc_action.c
parentf73e57538b043ce8b2e27e9f5acc7d95ea3e332f (diff)
downloadmandoc-c13cf29fb280ec0bdd7e124d786f95c82f3e2c71.tar.gz
Replacement of `Lb' in mdoc_action.c.
Added warning against bogus `Lb' (like groff does). Added proper quotes around `Lb' in mdoc_term.c. Moved mdoc_a2lib -> libmdoc (where it belongs).
Diffstat (limited to 'mdoc_action.c')
-rw-r--r--mdoc_action.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/mdoc_action.c b/mdoc_action.c
index 3da58be7..b3e471fc 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -41,6 +41,7 @@ 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);
+static int post_lb(POST_ARGS);
static int post_lk(POST_ARGS);
static int post_nm(POST_ARGS);
static int post_os(POST_ARGS);
@@ -159,7 +160,7 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL, NULL }, /* Hf */
{ NULL, NULL }, /* Fr */
{ NULL, NULL }, /* Ud */
- { NULL, NULL }, /* Lb */
+ { NULL, post_lb }, /* Lb */
{ NULL, NULL }, /* Lp */
{ NULL, post_lk }, /* Lk */
{ NULL, NULL }, /* Mt */
@@ -291,6 +292,36 @@ post_nm(POST_ARGS)
static int
+post_lb(POST_ARGS)
+{
+ const char *p;
+ char *buf;
+ size_t sz;
+
+ 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;