]> git.cameronkatri.com Git - mandoc.git/commitdiff
avoid duplicate "bad argument" error message, also shortening the code
authorIngo Schwarze <schwarze@openbsd.org>
Fri, 3 May 2019 18:39:34 +0000 (18:39 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Fri, 3 May 2019 18:39:34 +0000 (18:39 +0000)
main.c
manpath.c

diff --git a/main.c b/main.c
index bfe918b869d269f7a174f3480712cc02376e9ab5..8e8ca894a603b1fa28127c9091417a2b28446e50 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/*     $Id: main.c,v 1.326 2019/05/03 17:31:15 schwarze Exp $ */
+/*     $Id: main.c,v 1.327 2019/05/03 18:39:34 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -300,12 +300,9 @@ main(int argc, char *argv[])
                        search.outkey = oarg;
                else {
                        while (oarg != NULL) {
                        search.outkey = oarg;
                else {
                        while (oarg != NULL) {
-                               thisarg = oarg;
                                if (manconf_output(&conf.output,
                                if (manconf_output(&conf.output,
-                                   strsep(&oarg, ","), 0) == 0)
-                                       continue;
-                               warnx("-O %s: Bad argument", thisarg);
-                               return (int)MANDOCLEVEL_BADARG;
+                                   strsep(&oarg, ","), 0) == -1)
+                                       return (int)MANDOCLEVEL_BADARG;
                        }
                }
        }
                        }
                }
        }
index 1446787abd1dfcd3528ed8d5c0d2fd0ceb5c9963..703d6328dc12f4fd66bc6a80d3ba47f200d63703 100644 (file)
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/*     $Id: manpath.c,v 1.38 2019/05/03 18:23:53 schwarze Exp $ */
+/*     $Id: manpath.c,v 1.39 2019/05/03 18:39:34 schwarze Exp $ */
 /*
  * Copyright (c) 2011,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
 /*
  * Copyright (c) 2011,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -332,8 +332,7 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
                conf->toc = 1;
                return 0;
        default:
                conf->toc = 1;
                return 0;
        default:
-               if (fromfile)
-                       warnx("-O %s: Bad argument", cp);
+               warnx("-O %s: Bad argument", cp);
                return -1;
        }
        if (fromfile == 0)
                return -1;
        }
        if (fromfile == 0)