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

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

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

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

Legend:
Removed from v.517  
changed lines
  Added in v.518

  ViewVC Help
Powered by ViewVC