16 |
|
|
17 |
|
HostStatus::HostStatus() |
18 |
|
{ |
19 |
+ |
#ifndef __CYGWIN__ |
20 |
|
sputenv("TZ=:America/Los_Angeles"); |
21 |
+ |
#else |
22 |
+ |
sputenv("TZ= PST8PDT"); |
23 |
+ |
#endif |
24 |
+ |
tzset(); |
25 |
|
|
26 |
|
string method = sgetenv("REQUEST_METHOD"); |
27 |
|
|
33 |
|
{ |
34 |
|
string format = itor->second; |
35 |
|
|
36 |
< |
if (format == "t") |
32 |
< |
{ |
33 |
< |
this->format = table; |
34 |
< |
} |
35 |
< |
else |
36 |
< |
{ |
37 |
< |
this->format = page; |
38 |
< |
} |
36 |
> |
page = format != "t" ? true : false; |
37 |
|
} |
38 |
|
|
39 |
|
display(method); |
87 |
|
hostupdate << '\n' << flush; |
88 |
|
} |
89 |
|
|
90 |
< |
hostupdate.ignore(string::npos, '\n'); |
93 |
< |
hostupdate.ignore(string::npos, '\n'); |
90 |
> |
hostupdate.ignore(26); |
91 |
|
|
92 |
|
list<Host> hosts; |
93 |
|
bool done = false; |
115 |
|
} |
116 |
|
while (!done && hostupdate.good()); |
117 |
|
|
118 |
< |
if (format == page) header(); |
118 |
> |
if (page) header(); |
119 |
|
|
120 |
|
for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++) |
121 |
|
{ |
124 |
|
cout << host << flush; |
125 |
|
} |
126 |
|
|
127 |
< |
if (format == page) footer(); |
127 |
> |
if (page) footer(); |
128 |
> |
} |
129 |
> |
|
130 |
> |
void HostStatus::header() |
131 |
> |
{ |
132 |
> |
cout << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n" |
133 |
> |
<< "\t\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" |
134 |
> |
<< "<html>\n" |
135 |
> |
<< "<head>\n" |
136 |
> |
<< "<link rel=\"StyleSheet\" href=\"../stylesheets/regular.css\" type=" |
137 |
> |
<< "\"text/css\">\n" |
138 |
> |
<< "<title>Host Status</title>\n" |
139 |
> |
<< "</head>\n" |
140 |
> |
<< "<body>\n" |
141 |
> |
<< "<h1 id=\"title\" class=\"center\">Host Status</h1>\n" |
142 |
> |
<< "<table class=\"center\">\n"; |
143 |
> |
} |
144 |
> |
|
145 |
> |
void HostStatus::footer() |
146 |
> |
{ |
147 |
> |
cout << "</table>\n" |
148 |
> |
/* << "<pre>" << flush; |
149 |
> |
|
150 |
> |
ipstream env("env"); |
151 |
> |
|
152 |
> |
do |
153 |
> |
{ |
154 |
> |
string line; |
155 |
> |
|
156 |
> |
getline(env, line); |
157 |
> |
|
158 |
> |
cout << line << '\n'; |
159 |
> |
} |
160 |
> |
while (env.good()); |
161 |
> |
|
162 |
> |
cout << "</pre>\n"*/ |
163 |
> |
<< "</html>\n"; |
164 |
|
} |