Changeset 540 for trunk/bin


Ignore:
Timestamp:
Dec 29, 2007, 3:40:23 AM (14 years ago)
Author:
Peter Johansson
Message:

fixes automatic update of revision and copyright year in --version output. Options --version and --verbose can no be combined to get a slightly more detailed description.

Location:
trunk/bin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/Parameter.cc

    r538 r540  
    2525
    2626#include "ColumnStream.h"
     27#include "subversion_info.h"
    2728#include "utility.h"
    2829#include <config.h> // this header file is created by configure
    2930
     31#include <cstddef>
    3032#include <fstream>
    3133#include <iostream>
     
    116118      }
    117119      else if (myargv=="--version"){
    118           version();
    119           exit(0);
     120        version_=true;
     121        ok=true;
    120122      }
    121123      else if (myargv=="-vf" || myargv=="-fv"){
     
    130132    }
    131133
     134    if (version_){
     135      version(verbose_);
     136      exit(0);
     137    }     
    132138    analyse();
    133139  }
     
    191197    targetdir_=".";
    192198    verbose_=false;
     199    version_=false;
    193200  }
    194201
     
    238245
    239246
    240   void Parameter::version(void) const
     247  void Parameter::version(bool verbose) const
    241248  {
    242249    ColumnStream cs(std::cout, 1);
    243250    cs.width(0)=79;
    244     cs << PACKAGE_STRING
    245        << "\nCopyright (C) 2007 Jari Häkkinen and Peter Johansson.\n\n"
     251    cs << PACKAGE_STRING;
     252    if (verbose_) {
     253      cs << " (r" << svn_revision() << ")\n"
     254         << "   compiled " << __DATE__ ", " << __TIME__ << "\n";
     255    }
     256   
     257    cs << "\nCopyright (C) " << svn_year()
     258       << " Jari Häkkinen and Peter Johansson.\n\n"
    246259       << "This is free software; see the source for copying conditions. "
    247260       << "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR "
  • trunk/bin/Parameter.h

    r538 r540  
    5454    void defaults(void);
    5555    void help(void);
    56     void version(void) const;
     56    void version(bool=false) const;
    5757
    5858    std::string config_file_;
     
    6666    std::string targetdir_;
    6767    bool verbose_;
     68    bool version_;
    6869  };
    6970
Note: See TracChangeset for help on using the changeset viewer.