summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-01-27 13:47:10 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-01-27 13:47:10 +0000
commitf67234f1df04f274f9d9360bd62c6916d1f4878b (patch)
treeb7e0c425e331fef992ff5480362aad3cc420ca71 /main.c
parent7efe93e3b86eedc728ca70b488cc2c8cef9d1790 (diff)
downloadmandoc-f67234f1df04f274f9d9360bd62c6916d1f4878b.tar.gz
warn about invalid output options
and error out if they occur on the command line; missing feature found in the TODO file
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/main.c b/main.c
index 84533fcd..5382d0b2 100644
--- a/main.c
+++ b/main.c
@@ -123,6 +123,7 @@ main(int argc, char *argv[])
struct manpage *res, *resp;
char *conf_file, *defpaths;
const char *sec;
+ const char *thisarg;
size_t i, sz;
int prio, best_prio;
enum outmode outmode;
@@ -247,9 +248,14 @@ main(int argc, char *argv[])
break;
case 'O':
search.outkey = optarg;
- while (optarg != NULL)
- manconf_output(&conf.output,
- strsep(&optarg, ","));
+ while (optarg != NULL) {
+ thisarg = optarg;
+ if (manconf_output(&conf.output,
+ strsep(&optarg, ","), 0) == 0)
+ continue;
+ warnx("-O %s: Bad argument", thisarg);
+ return (int)MANDOCLEVEL_BADARG;
+ }
break;
case 'S':
search.arch = optarg;