2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

[master] improve command line error reporting

3799.	[bug]		Improve named's command line error reporting.
			[RT #35603]
This commit is contained in:
Evan Hunt
2014-04-03 19:34:48 -07:00
parent 0dfd942409
commit 44fbdddcad
2 changed files with 14 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
3799. [bug] Improve named's command line error reporting.
[RT #35603]
3798. [bug] 'rndc zonestatus' was reporting the wrong re-signing 3798. [bug] 'rndc zonestatus' was reporting the wrong re-signing
time. [RT #35659] time. [RT #35659]

View File

@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: main.c,v 1.187 2012/02/06 23:46:44 tbox Exp $ */
/*! \file */ /*! \file */
#include <config.h> #include <config.h>
@@ -416,16 +414,16 @@ static void
parse_command_line(int argc, char *argv[]) { parse_command_line(int argc, char *argv[]) {
int ch; int ch;
int port; int port;
const char *p;
isc_boolean_t disable6 = ISC_FALSE; isc_boolean_t disable6 = ISC_FALSE;
isc_boolean_t disable4 = ISC_FALSE; isc_boolean_t disable4 = ISC_FALSE;
save_command_line(argc, argv); save_command_line(argc, argv);
/* PLEASE keep options synchronized when main is hooked! */ /* PLEASE keep options synchronized when main is hooked! */
#define CMDLINE_FLAGS "46c:C:d:D:E:fFgi:lm:n:N:p:P:sS:t:T:U:u:vVx:"
isc_commandline_errprint = ISC_FALSE; isc_commandline_errprint = ISC_FALSE;
while ((ch = isc_commandline_parse(argc, argv, while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
"46c:C:d:D:E:fFgi:lm:n:N:p:P:"
"sS:t:T:U:u:vVx:")) != -1) {
switch (ch) { switch (ch) {
case '4': case '4':
if (disable4) if (disable4)
@@ -614,8 +612,14 @@ parse_command_line(int argc, char *argv[]) {
usage(); usage();
if (isc_commandline_option == '?') if (isc_commandline_option == '?')
exit(0); exit(0);
ns_main_earlyfatal("unknown option '-%c'", p = strchr(CMDLINE_FLAGS, isc_commandline_option);
isc_commandline_option); if (p == NULL || *++p != ':')
ns_main_earlyfatal("unknown option '-%c'",
isc_commandline_option);
else
ns_main_earlyfatal("option '-%c' requires "
"an argument",
isc_commandline_option);
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
ns_main_earlyfatal("parsing options returned %d", ch); ns_main_earlyfatal("parsing options returned %d", ch);