aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-19 21:51:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-19 21:51:20 +0000
commit79d152fe17d260ddca9686d56a71ecaa8d58ecd2 (patch)
tree67e99d2be668b0013c9877e147deb8a4e9483f07 /main.c
parent4f76006bc436b161a057a905ad55d9b213a6a141 (diff)
downloadmandoc-79d152fe17d260ddca9686d56a71ecaa8d58ecd2.tar.gz
mandoc-79d152fe17d260ddca9686d56a71ecaa8d58ecd2.tar.zst
mandoc-79d152fe17d260ddca9686d56a71ecaa8d58ecd2.zip
Generalize the mparse_alloc() and roff_alloc() functions by giving
them an "options" argument, replacing the existing "inttype" and "quick" arguments, preparing for a future MPARSE_SO option. Store this argument in struct mparse and struct roff, replacing the existing "inttype", "parsetype", and "quick" members. No functional change except one tiny cosmetic fix in roff_TH().
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/main.c b/main.c
index db4786cf..b05ddc93 100644
--- a/main.c
+++ b/main.c
@@ -1,7 +1,7 @@
-/* $Id: main.c,v 1.169 2014/01/06 00:53:33 schwarze Exp $ */
+/* $Id: main.c,v 1.170 2014/03/19 21:51:20 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -67,7 +67,7 @@ struct curparse {
char outopts[BUFSIZ]; /* buf of output opts */
};
-static int moptions(enum mparset *, char *);
+static int moptions(int *, char *);
static void mmsg(enum mandocerr, enum mandoclevel,
const char *, int, int, const char *);
static void parse(struct curparse *, int,
@@ -84,7 +84,7 @@ main(int argc, char *argv[])
{
int c;
struct curparse curp;
- enum mparset type;
+ int options;
enum mandoclevel rc;
char *defos;
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
memset(&curp, 0, sizeof(struct curparse));
- type = MPARSE_AUTO;
+ options = MPARSE_SO;
curp.outtype = OUTT_ASCII;
curp.wlevel = MANDOCLEVEL_FATAL;
defos = NULL;
@@ -118,7 +118,7 @@ main(int argc, char *argv[])
defos = mandoc_strdup(optarg + 3);
break;
case ('m'):
- if ( ! moptions(&type, optarg))
+ if ( ! moptions(&options, optarg))
return((int)MANDOCLEVEL_BADARG);
break;
case ('O'):
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
/* NOTREACHED */
}
- curp.mp = mparse_alloc(type, curp.wlevel, mmsg, defos, 0);
+ curp.mp = mparse_alloc(options, curp.wlevel, mmsg, defos);
/*
* Conditionally start up the lookaside buffer before parsing.
@@ -312,15 +312,15 @@ parse(struct curparse *curp, int fd,
}
static int
-moptions(enum mparset *tflags, char *arg)
+moptions(int *options, char *arg)
{
if (0 == strcmp(arg, "doc"))
- *tflags = MPARSE_MDOC;
+ *options |= MPARSE_MDOC;
else if (0 == strcmp(arg, "andoc"))
- *tflags = MPARSE_AUTO;
+ /* nothing to do */;
else if (0 == strcmp(arg, "an"))
- *tflags = MPARSE_MAN;
+ *options |= MPARSE_MAN;
else {
fprintf(stderr, "%s: Bad argument\n", arg);
return(0);