39 |
|
if ( debug == 1 ){ |
40 |
|
std::cout << "SysMon::collect::ipipestream\n"; |
41 |
|
} |
42 |
< |
ipipestream p("statgrab.pl"); |
42 |
> |
// ipipestream p("statgrab.pl"); |
43 |
> |
p = new SubPipe("statgrab.pl"); |
44 |
|
|
45 |
|
// get the output into input from statgrab |
46 |
< |
while ( p.getline (input, 2048) ){ |
46 |
> |
string sinput; |
47 |
> |
while ( p->getLine(&sinput) ){ |
48 |
|
// find the first non-whitespace char in input |
49 |
< |
string sinput = input; |
49 |
> |
|
50 |
|
// locate the first white space |
51 |
|
int found = sinput.find(" ",0); |
52 |
|
if ( found == string::npos ){ |
67 |
|
} |
68 |
|
gotTitle = 1; |
69 |
|
// now modify the data in the arrays if they are numbers |
70 |
< |
int * end; |
70 |
> |
char * end; |
71 |
|
char *buffer; |
72 |
|
// buffer = sinput.substr(found+1, sinput.length()); |
73 |
< |
double dbl = 0; // strtod((char *) sinput.substr(found+1, sinput.length()), &end); |
73 |
> |
double dbl = strtod( ((string) sinput.substr(found+1, sinput.length())).c_str(), &end); |
74 |
|
if ( dbl == 0 ){ |
75 |
|
// error? we aren't so sure. check the position |
76 |
|
// of end. |
77 |
|
if ( *end == sinput.length()-1 ){ |
78 |
|
// was the end.. ok |
79 |
< |
|
80 |
< |
} // if |
79 |
> |
// must have worked! |
80 |
> |
double dbl2 = 0; //strtod(values[i], &end); |
81 |
> |
dbl2 += dbl; |
82 |
> |
char * buffer; |
83 |
> |
int precision = 5; |
84 |
> |
int decimal, sign; |
85 |
> |
buffer = ecvt (dbl2, precision, &decimal, &sign); |
86 |
> |
} // if *end |
87 |
|
} else { |
88 |
|
// must have worked! |
89 |
|
double dbl2 = 0; //strtod(values[i], &end); |
90 |
|
dbl2 += dbl; |
91 |
< |
char *buffer; |
91 |
> |
char * buffer; |
92 |
|
int precision = 5; |
93 |
|
int decimal, sign; |
94 |
|
buffer = ecvt (dbl2, precision, &decimal, &sign); |
112 |
|
|
113 |
|
} // while |
114 |
|
|
115 |
< |
// delete p; |
115 |
> |
delete p; |
116 |
|
|
117 |
|
if ( debug == 1 ){ |
118 |
|
std::cout << "SysMon::collect::Parse from StatGrab finished\n"; |
142 |
|
string level = root; |
143 |
|
string attributes = ""; |
144 |
|
string attr = ""; |
145 |
< |
// while ( i < titlepointer ){ |
146 |
< |
// hard coding |
139 |
< |
while ( i < 10 ){ |
140 |
< |
finished = 0; |
145 |
> |
while ( i < titlepointer ){ |
146 |
> |
finished = 0; |
147 |
|
count = 0; |
148 |
|
attr = ""; |
149 |
|
while ( finished != 1 ){ |