Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 6991
Collapse All | Expand All

(-)colortail-0.3.0/CfgFileParser.cc (-4 / +4 lines)
Lines 19-30 Link Here
19
19
20
#include "CfgFileParser.h"
20
#include "CfgFileParser.h"
21
21
22
#include <stdio.h>
22
#include <iostream>
23
#include <fstream.h>
24
#include <assert.h>
23
#include <assert.h>
25
#include <string.h>
24
#include <string>
26
#include <malloc.h>
25
#include <malloc.h>
27
26
27
using namespace std;
28
28
29
// ## class SearchData ##
29
// ## class SearchData ##
30
30
Lines 499-505 Link Here
499
	 
499
	 
500
	 
500
	 
501
501
502
int CfgFileParser::parse(char *filename)
502
int CfgFileParser::parse(const char *filename)
503
{
503
{
504
   // parses the cfg file and sets up the list of SearchData elements
504
   // parses the cfg file and sets up the list of SearchData elements
505
   // returns number of SearchData items created
505
   // returns number of SearchData items created
(-)colortail-0.3.0/CfgFileParser.h (-3 / +4 lines)
Lines 25-31 Link Here
25
25
26
#include <sys/types.h>
26
#include <sys/types.h>
27
#include <regex.h>
27
#include <regex.h>
28
#include <fstream.h>
28
#include <iostream>
29
#include <fstream>
29
30
30
#ifdef HAVE_GNUREGEX_H
31
#ifdef HAVE_GNUREGEX_H
31
# include <gnuregex.h>
32
# include <gnuregex.h>
Lines 80-86 Link Here
80
{
81
{
81
  private:
82
  private:
82
   List<SearchData*> *m_items_list;
83
   List<SearchData*> *m_items_list;
83
   ifstream m_infile;
84
   std::ifstream m_infile;
84
   char *m_filename;
85
   char *m_filename;
85
   int m_line;
86
   int m_line;
86
87
Lines 97-103 Link Here
97
   CfgFileParser();
98
   CfgFileParser();
98
   ~CfgFileParser();
99
   ~CfgFileParser();
99
100
100
   int parse(char *filename);
101
   int parse(const char *filename);
101
   List<SearchData*>* get_items_list();
102
   List<SearchData*>* get_items_list();
102
};
103
};
103
104
(-)colortail-0.3.0/ColorTail.cc (-1 / +2 lines)
Lines 17-23 Link Here
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
18
*/
19
19
20
#include <iostream.h>
20
#include <iostream>
21
#include <assert.h>
21
#include <assert.h>
22
#include <unistd.h>
22
#include <unistd.h>
23
23
Lines 26-31 Link Here
26
#include "OptionsParser.h"
26
#include "OptionsParser.h"
27
#include "Colorizer.h"
27
#include "Colorizer.h"
28
28
29
using namespace std;
29
30
30
// the constructor
31
// the constructor
31
ColorTail::ColorTail()
32
ColorTail::ColorTail()
(-)colortail-0.3.0/Colorizer.cc (-8 / +9 lines)
Lines 22-30 Link Here
22
#include "TailFile.h"
22
#include "TailFile.h"
23
23
24
#include <assert.h>
24
#include <assert.h>
25
#include <stdio.h>
25
#include <iostream>
26
#include <strstream.h>
26
#include <string>
27
27
28
using namespace std;
28
29
29
Colorizer::Colorizer()
30
Colorizer::Colorizer()
30
{
31
{
Lines 58-64 Link Here
58
}
59
}
59
60
60
61
61
Colorizer::Colorizer(char *cfg_file)
62
Colorizer::Colorizer(const char *cfg_file)
62
{
63
{
63
   // other constructor
64
   // other constructor
64
   
65
   
Lines 85-91 Link Here
85
   free_items();
86
   free_items();
86
}
87
}
87
88
88
char* Colorizer::colorize(char *str)
89
const char* Colorizer::colorize(const char *str)
89
{
90
{
90
   // colorize the string, returns a new string containing
91
   // colorize the string, returns a new string containing
91
   // the colorized version of str
92
   // the colorized version of str
Lines 111-117 Link Here
111
   ListIterator<SearchData*> itr(*m_items_list);
112
   ListIterator<SearchData*> itr(*m_items_list);
112
113
113
   // will contain the new string
114
   // will contain the new string
114
   ostrstream newstr;
115
   ostringstream newstr;
115
   
116
   
116
   SearchData *current;
117
   SearchData *current;
117
   int i = 0;
118
   int i = 0;
Lines 174-180 Link Here
174
	    // write ansi reset str and a newline
175
	    // write ansi reset str and a newline
175
	    newstr << ANSI_RESET_STR << endl << ends;
176
	    newstr << ANSI_RESET_STR << endl << ends;
176
	    // return the new string
177
	    // return the new string
177
	    return newstr.str();
178
	    return newstr.str().c_str();
178
	 }
179
	 }
179
      }
180
      }
180
   }
181
   }
Lines 196-202 Link Here
196
      }
197
      }
197
198
198
      // return the new string
199
      // return the new string
199
      return newstr.str();
200
      return newstr.str().c_str();
200
   }
201
   }
201
202
202
   // did we find submatches?
203
   // did we find submatches?
Lines 250-256 Link Here
250
//      cout << "DEBUG: " << bla << " END DEBUG" << endl;
251
//      cout << "DEBUG: " << bla << " END DEBUG" << endl;
251
      
252
      
252
	 
253
	 
253
      return newstr.str();
254
      return newstr.str().c_str();
254
      
255
      
255
   }
256
   }
256
   
257
   
(-)colortail-0.3.0/Colorizer.h (-2 / +2 lines)
Lines 35-44 Link Here
35
   Colorizer();
35
   Colorizer();
36
      
36
      
37
  public:
37
  public:
38
      Colorizer(char *cfg_file);
38
      Colorizer(const char *cfg_file);
39
      ~Colorizer();
39
      ~Colorizer();
40
40
41
      char* colorize(char *str);
41
      const char* colorize(const char *str);
42
};
42
};
43
43
44
44
(-)colortail-0.3.0/Info.cc (-1 / +3 lines)
Lines 17-27 Link Here
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
18
*/
19
19
20
#include <iostream.h>
20
#include <iostream>
21
21
22
#include "Info.h"
22
#include "Info.h"
23
#include "config.h"
23
#include "config.h"
24
24
25
using namespace std;
26
25
Info::Info()
27
Info::Info()
26
{
28
{
27
}
29
}
(-)colortail-0.3.0/OptionsParser.cc (-5 / +6 lines)
Lines 17-24 Link Here
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
18
*/
19
19
20
#include <iostream.h>
20
#include <iostream>
21
#include <strstream.h>
21
#include <sstream>
22
#include <string.h>
22
#include <string.h>
23
#include <stdio.h>
23
#include <stdio.h>
24
#include <stdlib.h>
24
#include <stdlib.h>
Lines 27-32 Link Here
27
#include "Info.h"
27
#include "Info.h"
28
#include "Usage.h"
28
#include "Usage.h"
29
29
30
using namespace std;
30
// methods for class Options
31
// methods for class Options
31
32
32
Options::Options()
33
Options::Options()
Lines 130-136 Link Here
130
	    int loop = 1;
131
	    int loop = 1;
131
	    while (loop)
132
	    while (loop)
132
	    {
133
	    {
133
	       ostrstream filename;
134
	       ostringstream filename;
134
135
135
	       while (1)
136
	       while (1)
136
	       {
137
	       {
Lines 138-144 Link Here
138
		  {
139
		  {
139
		     // found seperator
140
		     // found seperator
140
		     // set filename in options class
141
		     // set filename in options class
141
		     o->cfg_filenames[o->nr_cfg_files] = filename.str();
142
		     o->cfg_filenames[o->nr_cfg_files] = filename.str().c_str();
142
143
143
		     // increase the nr_cfg_files counter
144
		     // increase the nr_cfg_files counter
144
		     (o->nr_cfg_files)++;
145
		     (o->nr_cfg_files)++;
Lines 154-160 Link Here
154
		  {
155
		  {
155
		     // found end of string
156
		     // found end of string
156
		     // set filename in options class
157
		     // set filename in options class
157
		     o->cfg_filenames[o->nr_cfg_files] = filename.str();
158
		     o->cfg_filenames[o->nr_cfg_files] = filename.str().c_str();
158
159
159
		     // increase the nr_cfg_files counter
160
		     // increase the nr_cfg_files counter
160
		     (o->nr_cfg_files)++;
161
		     (o->nr_cfg_files)++;
(-)colortail-0.3.0/OptionsParser.h (-1 / +1 lines)
Lines 77-83 Link Here
77
   int color;
77
   int color;
78
   int rows;
78
   int rows;
79
   int verbose;
79
   int verbose;
80
   char *cfg_filenames[MAX_FILES];
80
   const char *cfg_filenames[MAX_FILES];
81
   int nr_cfg_files;
81
   int nr_cfg_files;
82
   int global_cfg_file;
82
   int global_cfg_file;
83
83
(-)colortail-0.3.0/TailFile.cc (-5 / +7 lines)
Lines 17-23 Link Here
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
18
*/
19
19
20
#include <iostream.h>
20
#include <iostream>
21
#include <string.h>
21
#include <string.h>
22
#include <stdio.h>
22
#include <stdio.h>
23
#include <sys/stat.h>
23
#include <sys/stat.h>
Lines 25-30 Link Here
25
25
26
#include "TailFile.h"
26
#include "TailFile.h"
27
27
28
using namespace std;
29
28
TailFile::TailFile()
30
TailFile::TailFile()
29
{
31
{
30
   m_filename = NULL;
32
   m_filename = NULL;
Lines 375-381 Link Here
375
   // check if there isn't a follow buffer
377
   // check if there isn't a follow buffer
376
   if (m_follow_buffer == NULL)
378
   if (m_follow_buffer == NULL)
377
   {
379
   {
378
      m_follow_buffer = new ostrstream();
380
      m_follow_buffer = new ostringstream();
379
   }
381
   }
380
382
381
   // make buffer
383
   // make buffer
Lines 454-460 Link Here
454
	 m_follow_buffer->put('\0');
456
	 m_follow_buffer->put('\0');
455
457
456
	 // get the string
458
	 // get the string
457
	 char *str = m_follow_buffer->str();
459
	 const char *str = m_follow_buffer->str().c_str();
458
	 
460
	 
459
	 // print the line
461
	 // print the line
460
	 print_to_stdout(str);
462
	 print_to_stdout(str);
Lines 560-566 Link Here
560
//   delete buf;
562
//   delete buf;
561
}
563
}
562
564
563
void TailFile::print_to_stdout(char *str)
565
void TailFile::print_to_stdout(const char *str)
564
{
566
{
565
   // checks if there is a colorizer. If so the string is colorized
567
   // checks if there is a colorizer. If so the string is colorized
566
   // before it's printed. If not the string isn't colorized.
568
   // before it's printed. If not the string isn't colorized.
Lines 575-581 Link Here
575
   if (m_colorizer)
577
   if (m_colorizer)
576
   {
578
   {
577
      // colorize the string
579
      // colorize the string
578
      char *buf = m_colorizer->colorize(str);
580
      const char *buf = m_colorizer->colorize(str);
579
      // print the new colorized string
581
      // print the new colorized string
580
      cout << buf;
582
      cout << buf;
581
      // free the mem
583
      // free the mem
(-)colortail-0.3.0/TailFile.h (-3 / +3 lines)
Lines 23-29 Link Here
23
#include "Colorizer.h"
23
#include "Colorizer.h"
24
24
25
#include <stdio.h>
25
#include <stdio.h>
26
#include <strstream.h>
26
#include <sstream>
27
27
28
#define MAX_CHARS_READ 1024
28
#define MAX_CHARS_READ 1024
29
29
Lines 40-51 Link Here
40
   // the stream position
40
   // the stream position
41
   long m_position;
41
   long m_position;
42
   // the follow buffer, used in follow_print
42
   // the follow buffer, used in follow_print
43
   ostrstream *m_follow_buffer;
43
   std::ostringstream *m_follow_buffer;
44
44
45
   // private methods
45
   // private methods
46
   void find_position(int n);
46
   void find_position(int n);
47
   long end_of_file_position();
47
   long end_of_file_position();
48
   void print_to_stdout(char *str);
48
   void print_to_stdout(const char *str);
49
   
49
   
50
   // methods   
50
   // methods   
51
  public:
51
  public:
(-)colortail-0.3.0/Usage.cc (-1 / +3 lines)
Lines 17-26 Link Here
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
18
*/
19
19
20
#include <iostream.h>
20
#include <iostream>
21
21
22
#include "Usage.h"
22
#include "Usage.h"
23
23
24
using namespace std;
25
24
Usage::Usage()
26
Usage::Usage()
25
{
27
{
26
}
28
}

Return to bug 6991