]>
Commit | Line | Data |
---|---|---|
1 | diff -Naur CfgFileParser.cc.orig CfgFileParser.cc | |
2 | --- CfgFileParser.cc.orig Tue Aug 3 14:40:44 1999 | |
3 | +++ CfgFileParser.cc Sat Aug 24 16:03:58 2002 | |
4 | @@ -19,12 +19,12 @@ | |
5 | ||
6 | #include "CfgFileParser.h" | |
7 | ||
8 | -#include <stdio.h> | |
9 | -#include <fstream.h> | |
10 | +#include <iostream> | |
11 | #include <assert.h> | |
12 | -#include <string.h> | |
13 | +#include <string> | |
14 | #include <malloc.h> | |
15 | ||
16 | +using namespace std; | |
17 | ||
18 | // ## class SearchData ## | |
19 | ||
20 | @@ -499,7 +499,7 @@ | |
21 | ||
22 | ||
23 | ||
24 | -int CfgFileParser::parse(char *filename) | |
25 | +int CfgFileParser::parse(const char *filename) | |
26 | { | |
27 | // parses the cfg file and sets up the list of SearchData elements | |
28 | // returns number of SearchData items created | |
29 | diff -Naur CfgFileParser.h.orig CfgFileParser.h | |
30 | --- CfgFileParser.h.orig Tue Aug 3 14:40:52 1999 | |
31 | +++ CfgFileParser.h Sat Aug 24 16:03:21 2002 | |
32 | @@ -25,7 +25,8 @@ | |
33 | ||
34 | #include <sys/types.h> | |
35 | #include <regex.h> | |
36 | -#include <fstream.h> | |
37 | +#include <iostream> | |
38 | +#include <fstream> | |
39 | ||
40 | #ifdef HAVE_GNUREGEX_H | |
41 | # include <gnuregex.h> | |
42 | @@ -80,7 +81,7 @@ | |
43 | { | |
44 | private: | |
45 | List<SearchData*> *m_items_list; | |
46 | - ifstream m_infile; | |
47 | + std::ifstream m_infile; | |
48 | char *m_filename; | |
49 | int m_line; | |
50 | ||
51 | @@ -97,7 +98,7 @@ | |
52 | CfgFileParser(); | |
53 | ~CfgFileParser(); | |
54 | ||
55 | - int parse(char *filename); | |
56 | + int parse(const char *filename); | |
57 | List<SearchData*>* get_items_list(); | |
58 | }; | |
59 | ||
60 | diff -Naur ColorTail.cc.orig ColorTail.cc | |
61 | --- ColorTail.cc.orig Tue Aug 3 14:41:02 1999 | |
62 | +++ ColorTail.cc Sat Aug 24 15:28:21 2002 | |
63 | @@ -17,7 +17,7 @@ | |
64 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
65 | */ | |
66 | ||
67 | -#include <iostream.h> | |
68 | +#include <iostream> | |
69 | #include <assert.h> | |
70 | #include <unistd.h> | |
71 | ||
72 | @@ -26,6 +26,7 @@ | |
73 | #include "OptionsParser.h" | |
74 | #include "Colorizer.h" | |
75 | ||
76 | +using namespace std; | |
77 | ||
78 | // the constructor | |
79 | ColorTail::ColorTail() | |
80 | diff -Naur Colorizer.cc.orig Colorizer.cc | |
81 | --- Colorizer.cc.orig Tue Aug 3 14:41:17 1999 | |
82 | +++ Colorizer.cc Sat Aug 24 16:07:33 2002 | |
83 | @@ -22,9 +22,10 @@ | |
84 | #include "TailFile.h" | |
85 | ||
86 | #include <assert.h> | |
87 | -#include <stdio.h> | |
88 | -#include <strstream.h> | |
89 | +#include <iostream> | |
90 | +#include <string> | |
91 | ||
92 | +using namespace std; | |
93 | ||
94 | Colorizer::Colorizer() | |
95 | { | |
96 | @@ -58,7 +59,7 @@ | |
97 | } | |
98 | ||
99 | ||
100 | -Colorizer::Colorizer(char *cfg_file) | |
101 | +Colorizer::Colorizer(const char *cfg_file) | |
102 | { | |
103 | // other constructor | |
104 | ||
105 | @@ -85,7 +86,7 @@ | |
106 | free_items(); | |
107 | } | |
108 | ||
109 | -char* Colorizer::colorize(char *str) | |
110 | +const char* Colorizer::colorize(const char *str) | |
111 | { | |
112 | // colorize the string, returns a new string containing | |
113 | // the colorized version of str | |
114 | @@ -111,7 +112,7 @@ | |
115 | ListIterator<SearchData*> itr(*m_items_list); | |
116 | ||
117 | // will contain the new string | |
118 | - ostrstream newstr; | |
119 | + ostringstream newstr; | |
120 | ||
121 | SearchData *current; | |
122 | int i = 0; | |
123 | @@ -174,7 +175,7 @@ | |
124 | // write ansi reset str and a newline | |
125 | newstr << ANSI_RESET_STR << endl << ends; | |
126 | // return the new string | |
127 | - return newstr.str(); | |
128 | + return newstr.str().c_str(); | |
129 | } | |
130 | } | |
131 | } | |
132 | @@ -196,7 +197,7 @@ | |
133 | } | |
134 | ||
135 | // return the new string | |
136 | - return newstr.str(); | |
137 | + return newstr.str().c_str(); | |
138 | } | |
139 | ||
140 | // did we find submatches? | |
141 | @@ -250,7 +251,7 @@ | |
142 | // cout << "DEBUG: " << bla << " END DEBUG" << endl; | |
143 | ||
144 | ||
145 | - return newstr.str(); | |
146 | + return newstr.str().c_str(); | |
147 | ||
148 | } | |
149 | ||
150 | diff -Naur Colorizer.h.orig Colorizer.h | |
151 | --- Colorizer.h.orig Tue Aug 3 14:41:25 1999 | |
152 | +++ Colorizer.h Sat Aug 24 16:07:43 2002 | |
153 | @@ -35,10 +35,10 @@ | |
154 | Colorizer(); | |
155 | ||
156 | public: | |
157 | - Colorizer(char *cfg_file); | |
158 | + Colorizer(const char *cfg_file); | |
159 | ~Colorizer(); | |
160 | ||
161 | - char* colorize(char *str); | |
162 | + const char* colorize(const char *str); | |
163 | }; | |
164 | ||
165 | ||
166 | diff -Naur Info.cc.orig Info.cc | |
167 | --- Info.cc.orig Tue Aug 3 14:41:38 1999 | |
168 | +++ Info.cc Sat Aug 24 15:58:29 2002 | |
169 | @@ -17,11 +17,13 @@ | |
170 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
171 | */ | |
172 | ||
173 | -#include <iostream.h> | |
174 | +#include <iostream> | |
175 | ||
176 | #include "Info.h" | |
177 | #include "config.h" | |
178 | ||
179 | +using namespace std; | |
180 | + | |
181 | Info::Info() | |
182 | { | |
183 | } | |
184 | diff -Naur OptionsParser.cc.orig OptionsParser.cc | |
185 | --- OptionsParser.cc.orig Wed Aug 4 18:23:39 1999 | |
186 | +++ OptionsParser.cc Sat Aug 24 15:59:41 2002 | |
187 | @@ -17,8 +17,8 @@ | |
188 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
189 | */ | |
190 | ||
191 | -#include <iostream.h> | |
192 | -#include <strstream.h> | |
193 | +#include <iostream> | |
194 | +#include <sstream> | |
195 | #include <string.h> | |
196 | #include <stdio.h> | |
197 | #include <stdlib.h> | |
198 | @@ -27,6 +27,7 @@ | |
199 | #include "Info.h" | |
200 | #include "Usage.h" | |
201 | ||
202 | +using namespace std; | |
203 | // methods for class Options | |
204 | ||
205 | Options::Options() | |
206 | @@ -130,7 +131,7 @@ | |
207 | int loop = 1; | |
208 | while (loop) | |
209 | { | |
210 | - ostrstream filename; | |
211 | + ostringstream filename; | |
212 | ||
213 | while (1) | |
214 | { | |
215 | @@ -138,7 +139,7 @@ | |
216 | { | |
217 | // found seperator | |
218 | // set filename in options class | |
219 | - o->cfg_filenames[o->nr_cfg_files] = filename.str(); | |
220 | + o->cfg_filenames[o->nr_cfg_files] = filename.str().c_str(); | |
221 | ||
222 | // increase the nr_cfg_files counter | |
223 | (o->nr_cfg_files)++; | |
224 | @@ -154,7 +155,7 @@ | |
225 | { | |
226 | // found end of string | |
227 | // set filename in options class | |
228 | - o->cfg_filenames[o->nr_cfg_files] = filename.str(); | |
229 | + o->cfg_filenames[o->nr_cfg_files] = filename.str().c_str(); | |
230 | ||
231 | // increase the nr_cfg_files counter | |
232 | (o->nr_cfg_files)++; | |
233 | diff -Naur OptionsParser.h.orig OptionsParser.h | |
234 | --- OptionsParser.h.orig Wed Aug 4 18:33:08 1999 | |
235 | +++ OptionsParser.h Sat Aug 24 16:00:42 2002 | |
236 | @@ -77,7 +77,7 @@ | |
237 | int color; | |
238 | int rows; | |
239 | int verbose; | |
240 | - char *cfg_filenames[MAX_FILES]; | |
241 | + const char *cfg_filenames[MAX_FILES]; | |
242 | int nr_cfg_files; | |
243 | int global_cfg_file; | |
244 | ||
245 | diff -Naur TailFile.cc.orig TailFile.cc | |
246 | --- TailFile.cc.orig Wed Aug 4 18:09:38 1999 | |
247 | +++ TailFile.cc Sat Aug 24 16:08:12 2002 | |
248 | @@ -17,7 +17,7 @@ | |
249 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
250 | */ | |
251 | ||
252 | -#include <iostream.h> | |
253 | +#include <iostream> | |
254 | #include <string.h> | |
255 | #include <stdio.h> | |
256 | #include <sys/stat.h> | |
257 | @@ -25,6 +25,8 @@ | |
258 | ||
259 | #include "TailFile.h" | |
260 | ||
261 | +using namespace std; | |
262 | + | |
263 | TailFile::TailFile() | |
264 | { | |
265 | m_filename = NULL; | |
266 | @@ -375,7 +377,7 @@ | |
267 | // check if there isn't a follow buffer | |
268 | if (m_follow_buffer == NULL) | |
269 | { | |
270 | - m_follow_buffer = new ostrstream(); | |
271 | + m_follow_buffer = new ostringstream(); | |
272 | } | |
273 | ||
274 | // make buffer | |
275 | @@ -454,7 +456,7 @@ | |
276 | m_follow_buffer->put('\0'); | |
277 | ||
278 | // get the string | |
279 | - char *str = m_follow_buffer->str(); | |
280 | + const char *str = m_follow_buffer->str().c_str(); | |
281 | ||
282 | // print the line | |
283 | print_to_stdout(str); | |
284 | @@ -560,7 +562,7 @@ | |
285 | // delete buf; | |
286 | } | |
287 | ||
288 | -void TailFile::print_to_stdout(char *str) | |
289 | +void TailFile::print_to_stdout(const char *str) | |
290 | { | |
291 | // checks if there is a colorizer. If so the string is colorized | |
292 | // before it's printed. If not the string isn't colorized. | |
293 | @@ -575,7 +577,7 @@ | |
294 | if (m_colorizer) | |
295 | { | |
296 | // colorize the string | |
297 | - char *buf = m_colorizer->colorize(str); | |
298 | + const char *buf = m_colorizer->colorize(str); | |
299 | // print the new colorized string | |
300 | cout << buf; | |
301 | // free the mem | |
302 | diff -Naur TailFile.h.orig TailFile.h | |
303 | --- TailFile.h.orig Tue Aug 3 14:42:33 1999 | |
304 | +++ TailFile.h Sat Aug 24 16:06:00 2002 | |
305 | @@ -23,7 +23,7 @@ | |
306 | #include "Colorizer.h" | |
307 | ||
308 | #include <stdio.h> | |
309 | -#include <strstream.h> | |
310 | +#include <sstream> | |
311 | ||
312 | #define MAX_CHARS_READ 1024 | |
313 | ||
314 | @@ -40,12 +40,12 @@ | |
315 | // the stream position | |
316 | long m_position; | |
317 | // the follow buffer, used in follow_print | |
318 | - ostrstream *m_follow_buffer; | |
319 | + std::ostringstream *m_follow_buffer; | |
320 | ||
321 | // private methods | |
322 | void find_position(int n); | |
323 | long end_of_file_position(); | |
324 | - void print_to_stdout(char *str); | |
325 | + void print_to_stdout(const char *str); | |
326 | ||
327 | // methods | |
328 | public: | |
329 | diff -Naur Usage.cc.orig Usage.cc | |
330 | --- Usage.cc.orig Wed Aug 4 18:44:37 1999 | |
331 | +++ Usage.cc Sat Aug 24 16:08:35 2002 | |
332 | @@ -17,10 +17,12 @@ | |
333 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
334 | */ | |
335 | ||
336 | -#include <iostream.h> | |
337 | +#include <iostream> | |
338 | ||
339 | #include "Usage.h" | |
340 | ||
341 | +using namespace std; | |
342 | + | |
343 | Usage::Usage() | |
344 | { | |
345 | } |