From 2b3f9168554bb673c8ddd5e40dc88253f5e8d999 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Thu, 26 Mar 2009 14:38:11 +0000 Subject: Initial front-end formatting for -man pages. --- man_macro.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'man_macro.c') 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. -- cgit