- /* $Id: mmain.c,v 1.5 2009/03/06 14:13:47 kristaps Exp $ */
+ /* $Id: mmain.c,v 1.6 2009/03/08 11:41:22 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
u_long bufsz; /* Input buffer size. */
char *in; /* Input file name. */
int fdin; /* Input file desc. */
+ int pflags; /* Parse flags. */
};
extern char *__progname;
-static int getsopts(struct mmain *, char *);
+static int optswarn(struct mmain *, char *);
+static int optsopt(struct mmain *, char *);
static int parse(struct mmain *);
static void msg_msg(void *, int, int, const char *);
static int msg_err(void *, int, int, const char *);
extern int optind;
- sz = strlcpy(opts, "VvW:", 32);
+ sz = strlcpy(opts, "VvW:f:", 32);
assert(sz < 32);
if (u) {
/* LINTED */
while (-1 != (c = getopt(argc, argv, opts)))
switch (c) {
+ case ('f'):
+ if ( ! optsopt(p, optarg))
+ return(-1);
+ break;
case ('v'):
p->dbg++;
break;
(void)printf("%s %s\n", __progname, VERSION);
return(0);
case ('W'):
- if ( ! getsopts(p, optarg))
+ if ( ! optswarn(p, optarg))
return(-1);
break;
case ('?'):
static int
-getsopts(struct mmain *p, char *arg)
+optsopt(struct mmain *p, char *arg)
+{
+ char *v;
+ char *toks[] = { "ignore-scope", NULL };
+
+ while (*arg)
+ switch (getsubopt(&arg, toks, &v)) {
+ case (0):
+ p->pflags |= MDOC_IGN_SCOPE;
+ break;
+ default:
+ return(0);
+ }
+
+ return(1);
+}
+
+
+static int
+optswarn(struct mmain *p, char *arg)
{
char *v;
char *toks[] = { "all", "compat",