1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

Lint help and usage in oned.cc

(cherry picked from commit d9b6cca19589db2b76443edf3bc683c8dac016db)

Conflicts:
	src/nebula/oned.cc
This commit is contained in:
JensHoffmann 2013-12-12 23:03:35 +01:00 committed by Ruben S. Montero
parent 1bfcc3a6c3
commit 419df715da

View File

@ -18,28 +18,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <ostream>
#include "Nebula.h"
using namespace std;
/* ------------------------------------------------------------------------- */
/* GLOBAL VARIABLES */
/* ------------------------------------------------------------------------- */
static const char * usage =
"\n oned [-h] [-v] [-f]\n\n"
"SYNOPSIS\n"
" Starts the OpenNebula daemon\n\n"
"OPTIONS\n"
"\t-v\tprints OpenNebula version and license\n"
"\t-h\tprints this help.\n"
"\t-f\tforeground, do not fork the oned daemon\n"
"\t-i\tinitialize the dabase and exit.\n";
static const char * susage =
"usage: oned [-h] [-v] [-f]\n";
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@ -51,6 +36,25 @@ static void print_license()
<< "(http://www.apache.org/licenses/LICENSE-2.0).\n";
}
static void print_usage(ostream& str)
{
str << "Usage: oned [-h] [-v] [-f] [-i]\n";
}
static void print_help()
{
print_usage(cout);
cout << "\n"
<< "SYNOPSIS\n"
<< " Starts the OpenNebula daemon\n\n"
<< "OPTIONS\n"
<< " -v\toutput version information and exit\n"
<< " -h\tdisplay this help and exit\n"
<< " -f\tforeground, do not fork the oned daemon\n"
<< " -i\tinitialize the dabase and exit\n";
}
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
@ -108,7 +112,7 @@ int main(int argc, char **argv)
exit(0);
break;
case 'h':
cout << usage;
print_help();
exit(0);
break;
case 'i':
@ -119,7 +123,7 @@ int main(int argc, char **argv)
foreground = true;
break;
default:
cerr << susage;
print_usage(cerr);
exit(-1);
break;
}