From 42086cc42adf44ae27f4fb890f74b34e5ff123fe Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 27 Jan 2017 14:41:40 +0000 Subject: merge manpath.c 1.32, main.c 1.280: warn about invalid output options --- main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 1e93ceb9..4c1da8c4 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.273.2.4 2017/01/09 17:57:15 schwarze Exp $ */ +/* $Id: main.c,v 1.273.2.5 2017/01/27 14:41:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze @@ -125,6 +125,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; @@ -251,9 +252,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; -- cgit v1.2.3-56-ge451