summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-27 16:18:13 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-27 16:18:13 +0000
commit971f7ac206ac7af70e97998c7ef5b4536efda79e (patch)
tree27e88af287b96db192d82640ab03b190da3b84a2 /mdoc.c
parent093fd946278d03ba2f1e7e6e6194129e51485c58 (diff)
downloadmandoc-971f7ac206ac7af70e97998c7ef5b4536efda79e.tar.gz
Following clue-stick applied by schwarze@, back out const-ness of regset
passed in to libmdoc and libman. Fix mdoc.3 and man.3 EXAMPLE sections to include regset. Add MDOC_SYNPRETTY flag cueing front-end to nicely format certain values as if SEC_SYNOPSIS were the current section.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mdoc.c b/mdoc.c
index 3d82b8d4..f2f5f1cf 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -192,8 +192,8 @@ mdoc_free(struct mdoc *mdoc)
* Allocate volatile and non-volatile parse resources.
*/
struct mdoc *
-mdoc_alloc(const struct regset *regs,
- void *data, int pflags, mandocmsg msg)
+mdoc_alloc(struct regset *regs, void *data,
+ int pflags, mandocmsg msg)
{
struct mdoc *p;
@@ -368,9 +368,18 @@ node_alloc(struct mdoc *m, int line, int pos,
p->pos = pos;
p->tok = tok;
p->type = type;
+
+ /* Flag analysis. */
+
if (MDOC_NEWLINE & m->flags)
p->flags |= MDOC_LINE;
m->flags &= ~MDOC_NEWLINE;
+
+ /* Section analysis. */
+
+ if (SEC_SYNOPSIS == p->sec)
+ p->flags |= MDOC_SYNPRETTY;
+
return(p);
}