author | Dennis Menschel <demichan at mail dot upb dot de> | 2009-03-20 23:23:05 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2009-03-22 17:15:32 (UTC) |
commit | 87cbeba4a750b1747dd32538c9c220145169cd2c (patch) (unidiff) | |
tree | 7953a6715c8ca0810cfaef4e1939fe2be534de3f | |
parent | 0c21a7a0d5b84dc6726462f0fbe51b8c32433262 (diff) | |
download | midillo-master.zip midillo-master.tar.gz midillo-master.tar.bz2 |
Added missing includes <cstring> and <cassert>, which are
required/enforced by GCC 4.3.
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/SMF.cc | 1 | ||||
-rw-r--r-- | lib/message.cc | 1 | ||||
-rw-r--r-- | tools/mididump.cc | 1 |
3 files changed, 3 insertions, 0 deletions
@@ -1,62 +1,63 @@ | |||
1 | #include <iostream> | 1 | #include <iostream> |
2 | #include <fstream> | 2 | #include <fstream> |
3 | #include <algorithm> | 3 | #include <algorithm> |
4 | #include <iterator> | 4 | #include <iterator> |
5 | #include <cstring> | ||
5 | #include <midillo/SMF.h> | 6 | #include <midillo/SMF.h> |
6 | 7 | ||
7 | namespace midillo { | 8 | namespace midillo { |
8 | using std::ifstream; | 9 | using std::ifstream; |
9 | using std::ofstream; | 10 | using std::ofstream; |
10 | using std::cin; | 11 | using std::cin; |
11 | using std::cout; | 12 | using std::cout; |
12 | using std::copy; | 13 | using std::copy; |
13 | using std::ostream_iterator; | 14 | using std::ostream_iterator; |
14 | using std::endl; | 15 | using std::endl; |
15 | 16 | ||
16 | void SMF_t::load(const char *f,bool stdinable) { | 17 | void SMF_t::load(const char *f,bool stdinable) { |
17 | if(stdinable && !strcmp(f,"-")) { | 18 | if(stdinable && !strcmp(f,"-")) { |
18 | load(cin); | 19 | load(cin); |
19 | }else{ | 20 | }else{ |
20 | ifstream s(f,std::ios::in|std::ios::binary); | 21 | ifstream s(f,std::ios::in|std::ios::binary); |
21 | load(s); | 22 | load(s); |
22 | } | 23 | } |
23 | } | 24 | } |
24 | 25 | ||
25 | void SMF_t::load(istream& s) { | 26 | void SMF_t::load(istream& s) { |
26 | mthd.load(s); | 27 | mthd.load(s); |
27 | tracks.resize(mthd.ntracks); | 28 | tracks.resize(mthd.ntracks); |
28 | tracks_t::iterator i = tracks.begin(); | 29 | tracks_t::iterator i = tracks.begin(); |
29 | for(int t=0;t<mthd.ntracks;++t,++i) { | 30 | for(int t=0;t<mthd.ntracks;++t,++i) { |
30 | i->load(s); | 31 | i->load(s); |
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
34 | void SMF_t::save(const char *f,bool stdoutable) const { | 35 | void SMF_t::save(const char *f,bool stdoutable) const { |
35 | if(stdoutable && !strcmp(f,"-")) { | 36 | if(stdoutable && !strcmp(f,"-")) { |
36 | save(cout); | 37 | save(cout); |
37 | }else{ | 38 | }else{ |
38 | ofstream s(f,std::ios::out|std::ios::trunc|std::ios::binary); | 39 | ofstream s(f,std::ios::out|std::ios::trunc|std::ios::binary); |
39 | save(s); | 40 | save(s); |
40 | } | 41 | } |
41 | } | 42 | } |
42 | 43 | ||
43 | void SMF_t::save(ostream& s) const { | 44 | void SMF_t::save(ostream& s) const { |
44 | mthd.save(s); | 45 | mthd.save(s); |
45 | for(tracks_t::const_iterator i=tracks.begin();i!=tracks.end();++i) { | 46 | for(tracks_t::const_iterator i=tracks.begin();i!=tracks.end();++i) { |
46 | i->save(s); | 47 | i->save(s); |
47 | } | 48 | } |
48 | } | 49 | } |
49 | 50 | ||
50 | void SMF_t::dump(ostream& s) const { | 51 | void SMF_t::dump(ostream& s) const { |
51 | std::ios::fmtflags ff = s.flags(); | 52 | std::ios::fmtflags ff = s.flags(); |
52 | s.unsetf(std::ios::hex); s.setf(std::ios::dec); | 53 | s.unsetf(std::ios::hex); s.setf(std::ios::dec); |
53 | s | 54 | s |
54 | << "SMF with " << tracks.size() << " track(s)" << endl | 55 | << "SMF with " << tracks.size() << " track(s)" << endl |
55 | << mthd << endl; | 56 | << mthd << endl; |
56 | copy( | 57 | copy( |
57 | tracks.begin(), tracks.end(), | 58 | tracks.begin(), tracks.end(), |
58 | ostream_iterator<MTrk_t>(s,"\n") ); | 59 | ostream_iterator<MTrk_t>(s,"\n") ); |
59 | s.flags(ff); | 60 | s.flags(ff); |
60 | } | 61 | } |
61 | 62 | ||
62 | } | 63 | } |
diff --git a/lib/message.cc b/lib/message.cc index 8f9e68a..6a5cfd6 100644 --- a/lib/message.cc +++ b/lib/message.cc | |||
@@ -1,194 +1,195 @@ | |||
1 | #include <algorithm> | 1 | #include <algorithm> |
2 | #include <iterator> | 2 | #include <iterator> |
3 | #include <cassert> | ||
3 | #include <midillo/message.h> | 4 | #include <midillo/message.h> |
4 | #include <midillo/util.h> | 5 | #include <midillo/util.h> |
5 | #include <midillo/exception.h> | 6 | #include <midillo/exception.h> |
6 | 7 | ||
7 | namespace midillo { | 8 | namespace midillo { |
8 | using std::copy; | 9 | using std::copy; |
9 | using std::ostream_iterator; | 10 | using std::ostream_iterator; |
10 | 11 | ||
11 | unsigned long message_t::calculate_save_size(int& rs) const { | 12 | unsigned long message_t::calculate_save_size(int& rs) const { |
12 | unsigned long rv = 0; | 13 | unsigned long rv = 0; |
13 | if(status!=rs) { | 14 | if(status!=rs) { |
14 | ++rv; | 15 | ++rv; |
15 | rs = status; | 16 | rs = status; |
16 | }else if((status&status_event_bits)==status_system) { | 17 | }else if((status&status_event_bits)==status_system) { |
17 | rs = -1; | 18 | rs = -1; |
18 | ++rv; // XXX: is it really needed? | 19 | ++rv; // XXX: is it really needed? |
19 | } | 20 | } |
20 | switch(status&status_event_bits) { | 21 | switch(status&status_event_bits) { |
21 | case status_note_off: | 22 | case status_note_off: |
22 | case status_note_on: | 23 | case status_note_on: |
23 | case status_polyphonic_key_pressure: // aka status_aftertouch | 24 | case status_polyphonic_key_pressure: // aka status_aftertouch |
24 | case status_control_change: | 25 | case status_control_change: |
25 | case status_pitch_wheel_change: | 26 | case status_pitch_wheel_change: |
26 | rv += 2; break; | 27 | rv += 2; break; |
27 | case status_program_change: | 28 | case status_program_change: |
28 | case status_channel_pressure: | 29 | case status_channel_pressure: |
29 | ++rv; break; | 30 | ++rv; break; |
30 | case status_system: | 31 | case status_system: |
31 | switch(status&status_system_bits) { | 32 | switch(status&status_system_bits) { |
32 | case status_system_sysex: | 33 | case status_system_sysex: |
33 | case status_system_end_of_sysex: | 34 | case status_system_end_of_sysex: |
34 | rv += data.size()+1; break; | 35 | rv += data.size()+1; break; |
35 | case status_system_MTC_quarter_frame: | 36 | case status_system_MTC_quarter_frame: |
36 | case status_system_song_select: | 37 | case status_system_song_select: |
37 | ++rv; break; | 38 | ++rv; break; |
38 | case status_system_song_position_pointer: | 39 | case status_system_song_position_pointer: |
39 | rv += 2; break; | 40 | rv += 2; break; |
40 | case status_system_tune_request: | 41 | case status_system_tune_request: |
41 | case status_system_timing_clock: // aka status_system_midi_clock | 42 | case status_system_timing_clock: // aka status_system_midi_clock |
42 | case status_system_midi_tick: | 43 | case status_system_midi_tick: |
43 | case status_system_start: // aka status_system_midi_start | 44 | case status_system_start: // aka status_system_midi_start |
44 | case status_system_stop: // aka status_system_midi_stop | 45 | case status_system_stop: // aka status_system_midi_stop |
45 | case status_system_continue: // aka status_system_midi_continue | 46 | case status_system_continue: // aka status_system_midi_continue |
46 | case status_system_active_sense: | 47 | case status_system_active_sense: |
47 | break; /* XXX: ensure there is no data? */ | 48 | break; /* XXX: ensure there is no data? */ |
48 | case status_system_meta: // also reset, but not for the purpose of midi file | 49 | case status_system_meta: // also reset, but not for the purpose of midi file |
49 | ++rv; | 50 | ++rv; |
50 | rv += calcVLsize(data.size()); | 51 | rv += calcVLsize(data.size()); |
51 | rv += data.size(); | 52 | rv += data.size(); |
52 | break; | 53 | break; |
53 | default: | 54 | default: |
54 | throw exception(CODEPOINT,"Internal error"); | 55 | throw exception(CODEPOINT,"Internal error"); |
55 | break; | 56 | break; |
56 | } | 57 | } |
57 | break; | 58 | break; |
58 | default: | 59 | default: |
59 | throw exception(CODEPOINT,"Internal error"); | 60 | throw exception(CODEPOINT,"Internal error"); |
60 | break; | 61 | break; |
61 | } | 62 | } |
62 | return rv; | 63 | return rv; |
63 | } | 64 | } |
64 | 65 | ||
65 | void message_t::save(int& rs,ostream& s) const { | 66 | void message_t::save(int& rs,ostream& s) const { |
66 | if(status!=rs) { | 67 | if(status!=rs) { |
67 | s.put(status); | 68 | s.put(status); |
68 | if(!s.good()) | 69 | if(!s.good()) |
69 | throw exception_output_error(CODEPOINT,"Error writing midi status byte"); | 70 | throw exception_output_error(CODEPOINT,"Error writing midi status byte"); |
70 | rs = status; | 71 | rs = status; |
71 | }else if((status&status_event_bits)==status_system) { | 72 | }else if((status&status_event_bits)==status_system) { |
72 | rs = -1; | 73 | rs = -1; |
73 | s.put(status); // XXX: is it really needed? | 74 | s.put(status); // XXX: is it really needed? |
74 | if(!s.good()) | 75 | if(!s.good()) |
75 | throw exception_output_error(CODEPOINT,"Error writing midi system status byte"); | 76 | throw exception_output_error(CODEPOINT,"Error writing midi system status byte"); |
76 | } | 77 | } |
77 | switch(status&status_event_bits) { | 78 | switch(status&status_event_bits) { |
78 | case status_note_off: | 79 | case status_note_off: |
79 | case status_note_on: | 80 | case status_note_on: |
80 | case status_polyphonic_key_pressure: // aka status_aftertouch | 81 | case status_polyphonic_key_pressure: // aka status_aftertouch |
81 | case status_control_change: | 82 | case status_control_change: |
82 | case status_pitch_wheel_change: | 83 | case status_pitch_wheel_change: |
83 | save_data(s,2); break; | 84 | save_data(s,2); break; |
84 | case status_program_change: | 85 | case status_program_change: |
85 | case status_channel_pressure: | 86 | case status_channel_pressure: |
86 | save_data(s,1); break; | 87 | save_data(s,1); break; |
87 | case status_system: | 88 | case status_system: |
88 | switch(status&status_system_bits) { | 89 | switch(status&status_system_bits) { |
89 | case status_system_sysex: | 90 | case status_system_sysex: |
90 | case status_system_end_of_sysex: | 91 | case status_system_end_of_sysex: |
91 | save_sysex(s); break; | 92 | save_sysex(s); break; |
92 | case status_system_MTC_quarter_frame: | 93 | case status_system_MTC_quarter_frame: |
93 | case status_system_song_select: | 94 | case status_system_song_select: |
94 | save_data(s,1); break; | 95 | save_data(s,1); break; |
95 | case status_system_song_position_pointer: | 96 | case status_system_song_position_pointer: |
96 | save_data(s,2); break; | 97 | save_data(s,2); break; |
97 | case status_system_tune_request: | 98 | case status_system_tune_request: |
98 | case status_system_timing_clock: // aka status_system_midi_clock | 99 | case status_system_timing_clock: // aka status_system_midi_clock |
99 | case status_system_midi_tick: | 100 | case status_system_midi_tick: |
100 | case status_system_start: // aka status_system_midi_start | 101 | case status_system_start: // aka status_system_midi_start |
101 | case status_system_stop: // aka status_system_midi_stop | 102 | case status_system_stop: // aka status_system_midi_stop |
102 | case status_system_continue: // aka status_system_midi_continue | 103 | case status_system_continue: // aka status_system_midi_continue |
103 | case status_system_active_sense: | 104 | case status_system_active_sense: |
104 | break; /* XXX: ensure there is no data? */ | 105 | break; /* XXX: ensure there is no data? */ |
105 | case status_system_meta: // also reset, but not for the purpose of midi file | 106 | case status_system_meta: // also reset, but not for the purpose of midi file |
106 | s.put(meta_status&0xFF); | 107 | s.put(meta_status&0xFF); |
107 | if(!s.good()) | 108 | if(!s.good()) |
108 | throw exception_output_error(CODEPOINT,"Error writing meta event"); | 109 | throw exception_output_error(CODEPOINT,"Error writing meta event"); |
109 | writeVL(s,data.size()); | 110 | writeVL(s,data.size()); |
110 | save_data(s); | 111 | save_data(s); |
111 | break; | 112 | break; |
112 | default: | 113 | default: |
113 | throw exception(CODEPOINT,"Internal error"); | 114 | throw exception(CODEPOINT,"Internal error"); |
114 | break; | 115 | break; |
115 | } | 116 | } |
116 | break; | 117 | break; |
117 | default: | 118 | default: |
118 | throw exception(CODEPOINT,"Internal error"); | 119 | throw exception(CODEPOINT,"Internal error"); |
119 | break; | 120 | break; |
120 | } | 121 | } |
121 | } | 122 | } |
122 | 123 | ||
123 | void message_t::load(int& rs,istream& s) { | 124 | void message_t::load(int& rs,istream& s) { |
124 | data.clear(); | 125 | data.clear(); |
125 | status = s.get(); | 126 | status = s.get(); |
126 | if(!s.good()) | 127 | if(!s.good()) |
127 | throw exception_input_error(CODEPOINT,"Error reading MIDI event status byte"); | 128 | throw exception_input_error(CODEPOINT,"Error reading MIDI event status byte"); |
128 | if(status&status_bit) { | 129 | if(status&status_bit) { |
129 | if((status&status_event_bits)!=status_system) | 130 | if((status&status_event_bits)!=status_system) |
130 | rs = status; | 131 | rs = status; |
131 | }else{ | 132 | }else{ |
132 | if(rs<0) | 133 | if(rs<0) |
133 | throw exception_invalid_input(CODEPOINT,"Attempt to rely on the absent running status"); | 134 | throw exception_invalid_input(CODEPOINT,"Attempt to rely on the absent running status"); |
134 | data.push_back(status); | 135 | data.push_back(status); |
135 | status = rs; | 136 | status = rs; |
136 | } | 137 | } |
137 | switch(status&status_event_bits) { | 138 | switch(status&status_event_bits) { |
138 | case status_note_off: | 139 | case status_note_off: |
139 | case status_note_on: | 140 | case status_note_on: |
140 | case status_polyphonic_key_pressure: // a.k.a. status_aftertouch | 141 | case status_polyphonic_key_pressure: // a.k.a. status_aftertouch |
141 | case status_control_change: | 142 | case status_control_change: |
142 | case status_pitch_wheel_change: | 143 | case status_pitch_wheel_change: |
143 | load_data(s,2); break; | 144 | load_data(s,2); break; |
144 | case status_program_change: | 145 | case status_program_change: |
145 | case status_channel_pressure: | 146 | case status_channel_pressure: |
146 | load_data(s,1); break; | 147 | load_data(s,1); break; |
147 | case status_system: | 148 | case status_system: |
148 | switch(status&status_system_bits) { | 149 | switch(status&status_system_bits) { |
149 | case status_system_sysex: | 150 | case status_system_sysex: |
150 | case status_system_end_of_sysex: | 151 | case status_system_end_of_sysex: |
151 | load_sysex(s); break; | 152 | load_sysex(s); break; |
152 | case status_system_MTC_quarter_frame: | 153 | case status_system_MTC_quarter_frame: |
153 | case status_system_song_select: | 154 | case status_system_song_select: |
154 | load_data(s,1); break; | 155 | load_data(s,1); break; |
155 | case status_system_song_position_pointer: | 156 | case status_system_song_position_pointer: |
156 | load_data(s,2); break; | 157 | load_data(s,2); break; |
157 | case status_system_tune_request: | 158 | case status_system_tune_request: |
158 | case status_system_timing_clock: // a.k.a. status_system_midi_clock | 159 | case status_system_timing_clock: // a.k.a. status_system_midi_clock |
159 | case status_system_midi_tick: | 160 | case status_system_midi_tick: |
160 | case status_system_start: // a.k.a. status_system_midi_start | 161 | case status_system_start: // a.k.a. status_system_midi_start |
161 | case status_system_stop: // a.k.a. status_system_midi_stop | 162 | case status_system_stop: // a.k.a. status_system_midi_stop |
162 | case status_system_continue: // a.k.a. status_system_midi_continue | 163 | case status_system_continue: // a.k.a. status_system_midi_continue |
163 | case status_system_active_sense: | 164 | case status_system_active_sense: |
164 | break; | 165 | break; |
165 | case status_system_meta: // also, reset, but not in midi files | 166 | case status_system_meta: // also, reset, but not in midi files |
166 | { | 167 | { |
167 | meta_status = s.get(); | 168 | meta_status = s.get(); |
168 | if(!s.good()) | 169 | if(!s.good()) |
169 | throw exception_input_error(CODEPOINT,"Error reading meta event type"); | 170 | throw exception_input_error(CODEPOINT,"Error reading meta event type"); |
170 | int l = readVL(s); | 171 | int l = readVL(s); |
171 | load_data(s,l); | 172 | load_data(s,l); |
172 | } | 173 | } |
173 | break; | 174 | break; |
174 | default: | 175 | default: |
175 | throw exception(CODEPOINT,"Internal error"); | 176 | throw exception(CODEPOINT,"Internal error"); |
176 | break; | 177 | break; |
177 | } | 178 | } |
178 | break; | 179 | break; |
179 | default: | 180 | default: |
180 | throw exception(CODEPOINT,"Internal error"); | 181 | throw exception(CODEPOINT,"Internal error"); |
181 | break; | 182 | break; |
182 | } | 183 | } |
183 | } | 184 | } |
184 | 185 | ||
185 | void message_t::save_data(ostream& s,int c) const { | 186 | void message_t::save_data(ostream& s,int c) const { |
186 | if(c!=data.size()) | 187 | if(c!=data.size()) |
187 | throw exception(CODEPOINT,"Writing corrupt data"); | 188 | throw exception(CODEPOINT,"Writing corrupt data"); |
188 | save_data(s); | 189 | save_data(s); |
189 | } | 190 | } |
190 | 191 | ||
191 | void message_t::save_data(ostream& s) const { | 192 | void message_t::save_data(ostream& s) const { |
192 | for(bytes_t::const_iterator i=data.begin();i!=data.end();++i) | 193 | for(bytes_t::const_iterator i=data.begin();i!=data.end();++i) |
193 | s.put(*i); | 194 | s.put(*i); |
194 | if(!s.good()) | 195 | if(!s.good()) |
diff --git a/tools/mididump.cc b/tools/mididump.cc index 83b7086..604bcc0 100644 --- a/tools/mididump.cc +++ b/tools/mididump.cc | |||
@@ -1,84 +1,85 @@ | |||
1 | #include <getopt.h> | 1 | #include <getopt.h> |
2 | #include <iostream> | 2 | #include <iostream> |
3 | #include <fstream> | 3 | #include <fstream> |
4 | #include <string> | 4 | #include <string> |
5 | #include <algorithm> | 5 | #include <algorithm> |
6 | #include <cstring> | ||
6 | using namespace std; | 7 | using namespace std; |
7 | #include <konforka/exception.h> | 8 | #include <konforka/exception.h> |
8 | #include <midillo/SMF.h> | 9 | #include <midillo/SMF.h> |
9 | using namespace midillo; | 10 | using namespace midillo; |
10 | 11 | ||
11 | #include "config.h" | 12 | #include "config.h" |
12 | #define PHEADER PACKAGE " " VERSION " - mididump - dump midi files" | 13 | #define PHEADER PACKAGE " " VERSION " - mididump - dump midi files" |
13 | #define PCOPY "Copyright (c) 2006 Klever Group" | 14 | #define PCOPY "Copyright (c) 2006 Klever Group" |
14 | 15 | ||
15 | static void usage(const char *p) { | 16 | static void usage(const char *p) { |
16 | cerr << PHEADER << endl | 17 | cerr << PHEADER << endl |
17 | << PCOPY << endl << endl | 18 | << PCOPY << endl << endl |
18 | << " " << p << " [options] [<input-file>[ <output-file>]]" << endl << endl | 19 | << " " << p << " [options] [<input-file>[ <output-file>]]" << endl << endl |
19 | << " -h, --help" << endl | 20 | << " -h, --help" << endl |
20 | << " --usage display this text" << endl | 21 | << " --usage display this text" << endl |
21 | << " -V, --version display version number" << endl | 22 | << " -V, --version display version number" << endl |
22 | << " -L, --license show license" << endl; | 23 | << " -L, --license show license" << endl; |
23 | } | 24 | } |
24 | 25 | ||
25 | main(int argc,char **argv) { | 26 | main(int argc,char **argv) { |
26 | try { | 27 | try { |
27 | while(true) { | 28 | while(true) { |
28 | static struct option opts[] = { | 29 | static struct option opts[] = { |
29 | { "help", no_argument, 0, 'h' }, | 30 | { "help", no_argument, 0, 'h' }, |
30 | { "usage", no_argument, 0, 'h' }, | 31 | { "usage", no_argument, 0, 'h' }, |
31 | { "version", no_argument, 0, 'V' }, | 32 | { "version", no_argument, 0, 'V' }, |
32 | { "license", no_argument, 0, 'L' }, | 33 | { "license", no_argument, 0, 'L' }, |
33 | { NULL, 0, 0, 0 } | 34 | { NULL, 0, 0, 0 } |
34 | }; | 35 | }; |
35 | int c = getopt_long(argc,argv,"f:hVLl",opts,NULL); | 36 | int c = getopt_long(argc,argv,"f:hVLl",opts,NULL); |
36 | if(c==-1) | 37 | if(c==-1) |
37 | break; | 38 | break; |
38 | switch(c) { | 39 | switch(c) { |
39 | case 'h': | 40 | case 'h': |
40 | usage(*argv); | 41 | usage(*argv); |
41 | exit(0); | 42 | exit(0); |
42 | break; | 43 | break; |
43 | case 'V': | 44 | case 'V': |
44 | cerr << VERSION << endl; | 45 | cerr << VERSION << endl; |
45 | exit(0); | 46 | exit(0); |
46 | break; | 47 | break; |
47 | case 'L': | 48 | case 'L': |
48 | extern const char *COPYING; | 49 | extern const char *COPYING; |
49 | cerr << COPYING << endl; | 50 | cerr << COPYING << endl; |
50 | exit(0); | 51 | exit(0); |
51 | break; | 52 | break; |
52 | default: | 53 | default: |
53 | cerr << "Huh??" << endl; | 54 | cerr << "Huh??" << endl; |
54 | break; | 55 | break; |
55 | } | 56 | } |
56 | } | 57 | } |
57 | const char *infile = "-"; | 58 | const char *infile = "-"; |
58 | if(optind<argc) | 59 | if(optind<argc) |
59 | infile = argv[optind++]; | 60 | infile = argv[optind++]; |
60 | const char *oufile = "-"; | 61 | const char *oufile = "-"; |
61 | if(optind<argc) | 62 | if(optind<argc) |
62 | oufile = argv[optind++]; | 63 | oufile = argv[optind++]; |
63 | if(optind<argc) { | 64 | if(optind<argc) { |
64 | usage(*argv); | 65 | usage(*argv); |
65 | exit(1); | 66 | exit(1); |
66 | } | 67 | } |
67 | SMF_t in(infile); | 68 | SMF_t in(infile); |
68 | if(strcmp(oufile,"-")) { | 69 | if(strcmp(oufile,"-")) { |
69 | ofstream s(oufile); s << in; | 70 | ofstream s(oufile); s << in; |
70 | }else{ | 71 | }else{ |
71 | cout << in; | 72 | cout << in; |
72 | } | 73 | } |
73 | return 0; | 74 | return 0; |
74 | }catch(konforka::exception& e) { | 75 | }catch(konforka::exception& e) { |
75 | cerr << "Oops... Konforka exception:" << endl | 76 | cerr << "Oops... Konforka exception:" << endl |
76 | << " what: " << e.what() << endl | 77 | << " what: " << e.what() << endl |
77 | << " where: " << e.where() << endl; | 78 | << " where: " << e.where() << endl; |
78 | return 1; | 79 | return 1; |
79 | }catch(exception& e) { | 80 | }catch(exception& e) { |
80 | cerr << "Oops... Exception:" << endl | 81 | cerr << "Oops... Exception:" << endl |
81 | << " what: " << e.what() << endl; | 82 | << " what: " << e.what() << endl; |
82 | return 1; | 83 | return 1; |
83 | } | 84 | } |
84 | } | 85 | } |