diff options
Diffstat (limited to 'usr.bin/mandoc/mdoc_action.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_action.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/usr.bin/mandoc/mdoc_action.c b/usr.bin/mandoc/mdoc_action.c index 856b38d56c1..fec0c6cc32f 100644 --- a/usr.bin/mandoc/mdoc_action.c +++ b/usr.bin/mandoc/mdoc_action.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.33 2010/05/14 19:52:43 schwarze Exp $ */ +/* $Id: mdoc_action.c,v 1.34 2010/05/15 16:48:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -362,9 +362,10 @@ post_st(POST_ARGS) assert(MDOC_TEXT == n->child->type); p = mdoc_a2st(n->child->string); - assert(p); - free(n->child->string); - n->child->string = mandoc_strdup(p); + if (p != NULL) { + free(n->child->string); + n->child->string = mandoc_strdup(p); + } return(1); } @@ -377,15 +378,27 @@ post_st(POST_ARGS) static int post_at(POST_ARGS) { - struct mdoc_node *nn; - const char *p; + struct mdoc_node *nn; + const char *p, *q; + char *buf; + size_t sz; if (n->child) { assert(MDOC_TEXT == n->child->type); p = mdoc_a2att(n->child->string); - assert(p); - free(n->child->string); - n->child->string = mandoc_strdup(p); + if (p) { + free(n->child->string); + n->child->string = mandoc_strdup(p); + } else { + p = "AT&T UNIX "; + q = n->child->string; + sz = strlen(p) + strlen(q) + 1; + buf = mandoc_malloc(sz); + strlcpy(buf, p, sz); + strlcat(buf, q, sz); + free(n->child->string); + n->child->string = buf; + } return(1); } |