summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-20 14:32:24 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-20 14:32:24 +0000
commit30510774a4850cab55791932099dc8fa033bcc8e (patch)
tree619a4dc8faaf17e8e13db5a42a5246226f4d57ab /main.c
parent2fed0f10ccdd17e7a5cab4745efdb1a9190e1cd8 (diff)
downloadmandoc-30510774a4850cab55791932099dc8fa033bcc8e.tar.gz
Silently ignore invalid -m input formats rather than erroring out.
As observed by Jan Stary <hans at stare dot cz>, this is useful such that after 'alias man="man -m $HOME/man"', 'man -l foo.1' still works. Simplify and shorten the description of -m, and use .Ic for macros.
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/main.c b/main.c
index 47840971..73d4aba8 100644
--- a/main.c
+++ b/main.c
@@ -93,7 +93,7 @@ static void fs_search(const struct mansearch *,
const struct manpaths *, int, char**,
struct manpage **, size_t *);
static int koptions(int *, char *);
-static int moptions(int *, char *);
+static void moptions(int *, char *);
static void mmsg(enum mandocerr, enum mandoclevel,
const char *, int, int, const char *);
static void outdata_alloc(struct curparse *);
@@ -442,8 +442,8 @@ main(int argc, char *argv[])
}
#endif
- if (search.argmode == ARG_FILE && ! moptions(&options, auxpaths))
- return (int)MANDOCLEVEL_BADARG;
+ if (search.argmode == ARG_FILE)
+ moptions(&options, auxpaths);
mchars_alloc();
curp.mp = mparse_alloc(options, curp.wlevel, mmsg, defos);
@@ -919,24 +919,16 @@ koptions(int *options, char *arg)
return 1;
}
-static int
+static void
moptions(int *options, char *arg)
{
if (arg == NULL)
- /* nothing to do */;
- else if (0 == strcmp(arg, "doc"))
+ return;
+ if (strcmp(arg, "doc") == 0)
*options |= MPARSE_MDOC;
- else if (0 == strcmp(arg, "andoc"))
- /* nothing to do */;
- else if (0 == strcmp(arg, "an"))
+ else if (strcmp(arg, "an") == 0)
*options |= MPARSE_MAN;
- else {
- warnx("-m %s: Bad argument", arg);
- return 0;
- }
-
- return 1;
}
static int