summaryrefslogtreecommitdiffstats
path: root/man_macro.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 14:38:11 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-26 14:38:11 +0000
commit2b3f9168554bb673c8ddd5e40dc88253f5e8d999 (patch)
treeb77660a67128df815b9b262f201b3e99f5239d4c /man_macro.c
parent3e5450d43d3c10157f2bc26fb800be01f4d42261 (diff)
downloadmandoc-2b3f9168554bb673c8ddd5e40dc88253f5e8d999.tar.gz
Initial front-end formatting for -man pages.
Diffstat (limited to 'man_macro.c')
-rw-r--r--man_macro.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/man_macro.c b/man_macro.c
index 518b1e8e..2b389b14 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -24,9 +24,35 @@
#include "libman.h"
+#define FL_NLINE (1 << 0)
+#define FL_TLINE (1 << 1)
+
static int man_args(struct man *, int,
int *, char *, char **);
+static int man_flags[MAN_MAX] = {
+ 0, /* __ */
+ 0, /* TH */
+ 0, /* SH */
+ 0, /* SS */
+ FL_TLINE, /* TP */
+ 0, /* LP */
+ 0, /* PP */
+ 0, /* P */
+ 0, /* IP */
+ 0, /* HP */
+ FL_NLINE, /* SM */
+ FL_NLINE, /* SB */
+ FL_NLINE, /* BI */
+ FL_NLINE, /* IB */
+ FL_NLINE, /* BR */
+ FL_NLINE, /* RB */
+ FL_NLINE, /* R */
+ FL_NLINE, /* B */
+ FL_NLINE, /* I */
+ FL_NLINE, /* IR */
+ FL_NLINE, /* RI */
+};
int
man_macro(struct man *man, int tok, int line,
@@ -55,6 +81,22 @@ man_macro(struct man *man, int tok, int line,
man->next = MAN_NEXT_SIBLING;
}
+ if (n == man->last && (FL_NLINE & man_flags[tok])) {
+ if (MAN_NLINE & man->flags)
+ return(man_verr(man, line, ppos,
+ "next-line scope already open"));
+ man->flags |= MAN_NLINE;
+ return(1);
+ }
+
+ if (FL_TLINE & man_flags[tok]) {
+ if (MAN_NLINE & man->flags)
+ return(man_verr(man, line, ppos,
+ "next-line scope already open"));
+ man->flags |= MAN_NLINE;
+ return(1);
+ }
+
/*
* Note that when TH is pruned, we'll be back at the root, so
* make sure that we don't clobber as its sibling.