From: Pieter Lexis Date: Tue, 10 Sep 2019 15:26:35 +0000 (+0200) Subject: Improve commandline error reporting for non-opts X-Git-Tag: dnsdist-1.4.0-rc3~27^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F8290%2Fhead;p=thirdparty%2Fpdns.git Improve commandline error reporting for non-opts Before: ``` pdns_server --launch=random --socket-dir=. foo Fatal: non-option on the command line, perhaps a '--setting=123' statement missed the '='? ``` After: ``` pdns_server --launch=random --socket-dir=. bar Sep 10 17:24:25 Unable to open /usr/local/etc/pdns.conf Fatal: non-options (bar) on the command line, perhaps a '--setting=123' statement missed the '='? pdns_server --launch=random --socket-dir=. bar foo Sep 10 17:24:25 Unable to open /usr/local/etc/pdns.conf Fatal: non-options (bar, foo) on the command line, perhaps a '--setting=123' statement missed the '='? ``` --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 0b7a8f098b..78d569df05 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -4646,7 +4646,20 @@ int main(int argc, char **argv) cleanSlashes(configname); if(!::arg().getCommands().empty()) { - cerr<<"Fatal: non-option on the command line, perhaps a '--setting=123' statement missed the '='?"< 1) { + cerr<<"s"; + } + cerr<<" ("; + bool first = true; + for (auto const c : ::arg().getCommands()) { + if (!first) { + cerr<<", "; + } + first = false; + cerr<