--- libgig/trunk/src/gigdump.cpp 2005/05/05 13:49:53 511 +++ libgig/trunk/src/gigdump.cpp 2005/05/08 16:19:34 518 @@ -27,11 +27,14 @@ #include #include +#include #include "gig.h" using namespace std; +string Revision(); +void PrintVersion(); void PrintSamples(gig::File* gig); void PrintInstruments(gig::File* gig); void PrintRegions(gig::Instrument* instr); @@ -44,6 +47,13 @@ PrintUsage(); return EXIT_FAILURE; } + if (argv[1][0] == '-') { + switch (argv[1][1]) { + case 'v': + PrintVersion(); + return EXIT_SUCCESS; + } + } FILE* hFile = fopen(argv[1], "r"); if (!hFile) { cout << "Invalid file argument!" << endl; @@ -313,8 +323,21 @@ } } +string Revision() { + string s = "$Revision: 1.16 $"; + return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword +} + +void PrintVersion() { + cout << "gigdump revision " << Revision() << endl; + cout << "using " << gig::libraryName() << " " << gig::libraryVersion() << endl; +} + void PrintUsage() { cout << "gigdump - parses Gigasampler files and prints out the content." << endl; cout << endl; - cout << "Usage: gigdump FILE" << endl; + cout << "Usage: gigdump [-v] FILE" << endl; + cout << endl; + cout << " -v Print version and exit." << endl; + cout << endl; }