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 * |
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 |
|
|
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) { |
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 |
} |
} |