Lint/refactor 'print_license' in oned.cc

Three improvements:
 * Version printed in the very first line
 * Use of copyright symbol (C)
 * 2002-X, X retrieved from localtime

Rename print_license to print_version for clarity.
This commit is contained in:
JensHoffmann committed 2013-12-12 21:59:05 +01:00
1 parent 1abee8aafc
commit efcccabd5e
1 file changed
+12 -6
+12 -6
View File
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include "Nebula.h"
@@ -43,12 +44,17 @@ static const char * susage =
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
static void print_license()
static void print_version()
{
cout<< "Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs\n\n"
<< Nebula::version() << " is distributed and licensed for use under the"
<< " terms of the\nApache License, Version 2.0 "
<< "(http://www.apache.org/licenses/LICENSE-2.0).\n";
time_t now = time(NULL);
struct tm* ltime = localtime(&now);
cout << Nebula::version() << "\n"
<< "Copyright (C) 2002-" << ltime->tm_year + 1900
<< ", OpenNebula Project (OpenNebula.org), C12G Labs\n"
<< Nebula::version() << " is distributed and licensed for use under "
<< "the terms of the\nApache License, Version 2.0 "
<< "(http://www.apache.org/licenses/LICENSE-2.0).\n";
}
/* ------------------------------------------------------------------------- */
@@ -104,7 +110,7 @@ int main(int argc, char **argv)
switch(opt)
{
case 'v':
print_license();
print_version();
exit(0);
break;
case 'h':