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 | a691b01d3c341059f53c726943f9381943abe885 (patch) | |
tree | 7bb1fa0b30f9625d13af868270a43bfa30433d27 /main.c | |
parent | dba36350d7b2c68fca35f6b5c95e565cae8a747b (diff) | |
download | mandoc-a691b01d3c341059f53c726943f9381943abe885.tar.gz mandoc-a691b01d3c341059f53c726943f9381943abe885.tar.zst mandoc-a691b01d3c341059f53c726943f9381943abe885.zip |
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 | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.279 2017/01/09 17:49:57 schwarze Exp $ */ +/* $Id: main.c,v 1.280 2017/01/27 13:47:10 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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; |