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