From efcccabd5e9881b3a15cae215532b83395af96ff Mon Sep 17 00:00:00 2001 From: JensHoffmann Date: Thu, 12 Dec 2013 21:59:05 +0100 Subject: [PATCH] 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. --- src/nebula/oned.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/nebula/oned.cc b/src/nebula/oned.cc index 5cfeda178f..f3406a9606 100644 --- a/src/nebula/oned.cc +++ b/src/nebula/oned.cc @@ -18,6 +18,7 @@ #include #include #include +#include #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':