| 232 |
|
} |
| 233 |
|
|
| 234 |
|
void processStats() { |
| 235 |
< |
int sleeping=0; |
| 235 |
> |
int sleeping=-1; |
| 236 |
|
int zombie=0; |
| 237 |
|
int stopped=0; |
| 238 |
|
int running=0; |
| 249 |
|
} |
| 250 |
|
|
| 251 |
|
while((line=fpgetline(f)) != NULL) { |
| 252 |
< |
line_p=strchr(line, ' '); |
| 253 |
< |
line_p++; |
| 254 |
< |
if (line_p==NULL) abort(); |
| 255 |
< |
/* Ok, we should now be at the state :) .. */ |
| 256 |
< |
if (*line_p=='S') sleeping++; |
| 257 |
< |
if (*line_p=='R') running++; |
| 258 |
< |
if (*line_p=='Z') zombie++; |
| 259 |
< |
if (*line_p=='T') stopped++; |
| 252 |
> |
|
| 253 |
> |
line_p=line; |
| 254 |
> |
for(; (*line_p == ' ') && (*line_p != '\0'); line_p++); |
| 255 |
> |
line_p=strchr(line_p, ' '); |
| 256 |
> |
for(; (*line_p == ' ') && (*line_p != '\0'); line_p++); |
| 257 |
> |
if (line_p==NULL) abort(); |
| 258 |
> |
/* Ok, we should now be at the state :) .. */ |
| 259 |
> |
if (*line_p=='S') sleeping++; |
| 260 |
> |
if (*line_p=='R') running++; |
| 261 |
> |
if (*line_p=='Z') zombie++; |
| 262 |
> |
if (*line_p=='T') stopped++; |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
if((pclose(f)) == -1) { |