/[svn]/libgig/trunk/src/tools/rifftree.cpp
ViewVC logotype

Diff of /libgig/trunk/src/tools/rifftree.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 55 by schoenebeck, Tue Apr 27 09:06:07 2004 UTC revision 933 by schoenebeck, Fri Nov 24 12:50:05 2006 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Christian Schoenebeck                     *   *   Copyright (C) 2003-2006 by Christian Schoenebeck                      *
6   *                               <cuse@users.sourceforge.net>              *   *                              <cuse@users.sourceforge.net>               *
7     *                                                                         *
8     *   This program is part of libgig.                                       *
9   *                                                                         *   *                                                                         *
10   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
11   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 27  Line 29 
29    
30  #include <stdio.h>  #include <stdio.h>
31  #include <iostream>  #include <iostream>
32    #include <string>
33  #include <cstdlib>  #include <cstdlib>
34    
35  #include "RIFF.h"  #include "RIFF.h"
36    
37  using namespace std;  using namespace std;
38    
39    string Revision();
40    void PrintVersion();
41  void PrintUsage();  void PrintUsage();
42  void PrintChunkList(RIFF::List* list, bool PrintSize);  void PrintChunkList(RIFF::List* list, bool PrintSize);
43    
# Line 45  int main(int argc, char *argv[]) Line 50  int main(int argc, char *argv[])
50          PrintUsage();          PrintUsage();
51          return EXIT_FAILURE;          return EXIT_FAILURE;
52      }      }
53      if (argc >= 3) {      if (argv[1][0] == '-') {
54          if (argv[1][0] == '-') {          switch (argv[1][1]) {
55              switch (argv[1][1]) {              case 's':
56                  case 's':                  bPrintSize = true;
57                      bPrintSize = true;                  break;
58                      break;              case 'v':
59                  default:                  PrintVersion();
60                      PrintUsage();                  return EXIT_SUCCESS;
61                      return EXIT_FAILURE;              default:
62              }                  cerr << "Unknown option -" << argv[1][1] << endl;
63              FileArgIndex++;                  cerr << endl;
64                    PrintUsage();
65                    return EXIT_FAILURE;
66          }          }
67            FileArgIndex++;
68        }
69        if (FileArgIndex >= argc) {
70            PrintUsage();
71            return EXIT_FAILURE;
72      }      }
73      FILE* hFile = fopen(argv[FileArgIndex], "r");      FILE* hFile = fopen(argv[FileArgIndex], "r");
74      if (!hFile) {      if (!hFile) {
# Line 112  void PrintChunkList(RIFF::List* list, bo Line 124  void PrintChunkList(RIFF::List* list, bo
124      }      }
125  }  }
126    
127    string Revision() {
128        string s = "$Revision: 1.4 $";
129        return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
130    }
131    
132    void PrintVersion() {
133        cout << "rifftree revision " << Revision() << endl;
134        cout << "using " << RIFF::libraryName() << " " << RIFF::libraryVersion() << endl;
135    }
136    
137  void PrintUsage() {  void PrintUsage() {
138      cout << "rifftree - parses an arbitrary RIFF file and prints out the RIFF tree structure." << endl;      cout << "rifftree - parses an arbitrary RIFF file and prints out the RIFF tree structure." << endl;
139      cout << endl;      cout << endl;
140      cout << "Usage: rifftree [-s] FILE" << endl;      cout << "Usage: rifftree [-s|-v] FILE" << endl;
141      cout << endl;      cout << endl;
142      cout << "   -s  Print the size of each chunk." << endl;      cout << "   -s  Print the size of each chunk." << endl;
143        cout << "   -v  Print version and exit." << endl;
144      cout << endl;      cout << endl;
145  }  }

Legend:
Removed from v.55  
changed lines
  Added in v.933

  ViewVC Help
Powered by ViewVC