diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-27 13:47:10 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-27 13:47:10 +0000 |
commit | f67234f1df04f274f9d9360bd62c6916d1f4878b (patch) | |
tree | b7e0c425e331fef992ff5480362aad3cc420ca71 /main.c | |
parent | 7efe93e3b86eedc728ca70b488cc2c8cef9d1790 (diff) | |
download | mandoc-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.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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; |