5 |
|
// $Id$ |
6 |
|
|
7 |
|
#include "HostStatus.hpp" |
8 |
+ |
#include "Host.hpp" |
9 |
|
|
10 |
|
int main(int argc, char* argv[]) |
11 |
|
{ |
16 |
|
|
17 |
|
HostStatus::HostStatus() |
18 |
|
{ |
19 |
+ |
sputenv("TZ=:America/Los_Angeles"); |
20 |
+ |
|
21 |
|
string method = sgetenv("REQUEST_METHOD"); |
22 |
|
|
23 |
|
parse(method); |
86 |
|
hostupdate << itor->first << '=' << itor->second << '&'; |
87 |
|
} |
88 |
|
|
89 |
< |
hostupdate << '\n'; |
89 |
> |
hostupdate << '\n' << flush; |
90 |
|
} |
91 |
|
|
92 |
+ |
hostupdate.ignore(string::npos, '\n'); |
93 |
+ |
hostupdate.ignore(string::npos, '\n'); |
94 |
+ |
|
95 |
+ |
list<Host> hosts; |
96 |
+ |
bool done = false; |
97 |
+ |
|
98 |
|
do |
99 |
|
{ |
100 |
< |
string line; |
100 |
> |
Host host; |
101 |
> |
|
102 |
> |
hostupdate >> host; |
103 |
> |
|
104 |
> |
hosts.push_back(host); |
105 |
> |
|
106 |
> |
switch (hostupdate.peek()) |
107 |
> |
{ |
108 |
> |
case 'h': |
109 |
> |
case 'n': |
110 |
> |
case 'a': |
111 |
> |
case 'p': |
112 |
> |
case 's': |
113 |
> |
break; |
114 |
> |
default: |
115 |
> |
done = true; |
116 |
> |
break; |
117 |
> |
} |
118 |
> |
} |
119 |
> |
while (!done && hostupdate.good()); |
120 |
|
|
121 |
< |
getline(hostupdate, line); |
121 |
> |
if (format == page) header(); |
122 |
|
|
123 |
< |
cout << line << '\n'; |
123 |
> |
for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++) |
124 |
> |
{ |
125 |
> |
Host host = *itor; |
126 |
> |
|
127 |
> |
cout << host << flush; |
128 |
|
} |
129 |
< |
while (hostupdate.good()); |
129 |
> |
|
130 |
> |
if (format == page) footer(); |
131 |
|
} |