Commit 88bc04d8 authored by Francis Dupont's avatar Francis Dupont
Browse files

[3513] Adopted standard order for usage (flags then options) and main (same with stricter alpha)

parent e96b4ab1
......@@ -436,14 +436,14 @@ DControllerBase::usage(const std::string & text)
}
std::cerr << "Usage: " << bin_name_ << std::endl
<< " -c <config file name> : mandatory,"
<< " specifies name of configuration file " << std::endl
<< " -d: optional, verbose output " << std::endl
<< " -v: print version number and exit" << std::endl
<< " -V: print extended version information and exit"
<< std::endl
<< " -W: display the configuration report and exit"
<< std::endl;
<< std::endl
<< " -d: optional, verbose output " << std::endl
<< " -c <config file name> : mandatory,"
<< " specifies name of configuration file " << std::endl;
// add any derivation specific usage
std::cerr << getUsageText() << std::endl;
......
......@@ -49,14 +49,14 @@ usage() {
cerr << "Kea DHCPv4 server, version " << VERSION << endl;
cerr << endl;
cerr << "Usage: " << DHCP4_NAME
<< " -[v|V|W] [-d] [-p number] [-c file]" << endl;
cerr << " -c file: specify configuration file" << endl;
cerr << " -d: debug mode with extra verbosity (former -v)" << endl;
cerr << " -p number: specify non-standard port number 1-65535 "
<< "(useful for testing only)" << endl;
<< " -[v|V|W] [-d] [-c file] [-p number]" << endl;
cerr << " -v: print version number and exit" << endl;
cerr << " -V: print extended version and exit" << endl;
cerr << " -W: display the configuration report and exit" << endl;
cerr << " -d: debug mode with extra verbosity (former -v)" << endl;
cerr << " -c file: specify configuration file" << endl;
cerr << " -p number: specify non-standard port number 1-65535 "
<< "(useful for testing only)" << endl;
exit(EXIT_FAILURE);
}
} // end of anonymous namespace
......@@ -71,7 +71,7 @@ main(int argc, char* argv[]) {
// The standard config file
std::string config_file("");
while ((ch = getopt(argc, argv, "dvVWp:c:")) != -1) {
while ((ch = getopt(argc, argv, "dvVWc:p:")) != -1) {
switch (ch) {
case 'd':
verbose_mode = true;
......@@ -89,6 +89,10 @@ main(int argc, char* argv[]) {
cout << isc::detail::getConfigReport() << endl;
return (EXIT_SUCCESS);
case 'c': // config file
config_file = optarg;
break;
case 'p':
try {
port_number = boost::lexical_cast<int>(optarg);
......@@ -104,10 +108,6 @@ main(int argc, char* argv[]) {
}
break;
case 'c': // config file
config_file = optarg;
break;
default:
usage();
}
......
......@@ -51,12 +51,12 @@ usage() {
cerr << "Kea DHCPv6 server, version " << VERSION << endl;
cerr << endl;
cerr << "Usage: " << DHCP6_NAME
<< " [-c cfgfile] -[v|V|W] [-d] [-p port_number]" << endl;
cerr << " -c file: specify configuration file" << endl;
<< " -[v|V|W] [-d] [-c cfgfile] [-p port_number]" << endl;
cerr << " -v: print version number and exit." << endl;
cerr << " -V: print extended version and exit" << endl;
cerr << " -W: display the configuration report and exit" << endl;
cerr << " -d: debug mode with extra verbosity (former -v)" << endl;
cerr << " -c file: specify configuration file" << endl;
cerr << " -p number: specify non-standard port number 1-65535 "
<< "(useful for testing only)" << endl;
exit(EXIT_FAILURE);
......@@ -73,7 +73,7 @@ main(int argc, char* argv[]) {
// The standard config file
std::string config_file("");
while ((ch = getopt(argc, argv, "dvVWp:c:")) != -1) {
while ((ch = getopt(argc, argv, "dvVWc:p:")) != -1) {
switch (ch) {
case 'd':
verbose_mode = true;
......@@ -91,6 +91,10 @@ main(int argc, char* argv[]) {
cout << isc::detail::getConfigReport() << endl;
return (EXIT_SUCCESS);
case 'c': // config file
config_file = optarg;
break;
case 'p': // port number
try {
port_number = boost::lexical_cast<int>(optarg);
......@@ -106,10 +110,6 @@ main(int argc, char* argv[]) {
}
break;
case 'c': // config file
config_file = optarg;
break;
default:
usage();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment