summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-04-02 16:37:40 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-04-02 16:37:40 +0000
commitc6f2ac2795830a6dad4bb85a704413a2a9f0333c (patch)
tree9df4689f8928c8f1033961943dbd63bd89182b08 /main.c
parentcdb6fd7e9ca0c4e288d47005adc9c5de83127a32 (diff)
downloadmandoc-c6f2ac2795830a6dad4bb85a704413a2a9f0333c.tar.gz
Added -p1003.1-2008 specification.
Fixed invalid memory accesses (concat()). Made -fign-macro be the default for libman.
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.c b/main.c
index 94dd4f94..c9bd227d 100644
--- a/main.c
+++ b/main.c
@@ -76,6 +76,7 @@ struct curparse {
#define IGN_SCOPE (1 << 0) /* Ignore scope errors. */
#define IGN_ESCAPE (1 << 1) /* Ignore bad escapes. */
#define IGN_MACRO (1 << 2) /* Ignore unknown macros. */
+#define NO_IGN_MACRO (1 << 3)
typedef int (*out_run)(void *, const struct man *,
const struct mdoc *);
@@ -264,10 +265,13 @@ man_init(struct curparse *curp)
mancb.man_err = merr;
mancb.man_warn = manwarn;
- pflags = 0;
+ /* Set command defaults. */
+ pflags = MAN_IGN_MACRO;
if (curp->fflags & IGN_MACRO)
pflags |= MAN_IGN_MACRO;
+ if (curp->fflags & NO_IGN_MACRO)
+ pflags &= ~MAN_IGN_MACRO;
if (NULL == (man = man_alloc(curp, pflags, &mancb)))
warnx("memory exhausted");
@@ -540,12 +544,13 @@ static int
foptions(int *fflags, char *arg)
{
char *v;
- char *toks[4];
+ char *toks[5];
toks[0] = "ign-scope";
toks[1] = "ign-escape";
toks[2] = "ign-macro";
- toks[3] = NULL;
+ toks[4] = "no-ign-macro";
+ toks[5] = NULL;
while (*arg)
switch (getsubopt(&arg, toks, &v)) {
@@ -558,6 +563,9 @@ foptions(int *fflags, char *arg)
case (2):
*fflags |= IGN_MACRO;
break;
+ case (3):
+ *fflags |= NO_IGN_MACRO;
+ break;
default:
warnx("bad argument: -f%s", arg);
return(0);