12 |
|
#include <iostream> |
13 |
|
#include <string> |
14 |
|
#include <sstream> |
15 |
+ |
#include <list> |
16 |
+ |
#include <set> |
17 |
|
#include <map> |
18 |
|
#include <cstdlib> |
19 |
|
#include <ctime> |
35 |
|
char* value = new char[name.size() + 1]; |
36 |
|
|
37 |
|
sprintf(value, name.c_str()); |
38 |
< |
|
38 |
> |
|
39 |
|
int code = putenv(value); |
40 |
|
|
41 |
+ |
delete [] value; |
42 |
+ |
|
43 |
|
return code; |
44 |
|
} |
45 |
|
|
46 |
|
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
47 |
|
|
48 |
+ |
#ifdef __CYGWIN__ |
49 |
+ |
|
50 |
+ |
inline time_t timegm(struct tm* time) |
51 |
+ |
{ |
52 |
+ |
string zone = sgetenv("TZ"); |
53 |
+ |
|
54 |
+ |
sputenv("TZ="); |
55 |
+ |
tzset(); |
56 |
+ |
|
57 |
+ |
time_t when = mktime(time); |
58 |
+ |
|
59 |
+ |
sputenv("TZ=" + zone); |
60 |
+ |
tzset(); |
61 |
+ |
|
62 |
+ |
return when; |
63 |
+ |
} |
64 |
+ |
|
65 |
+ |
#endif |
66 |
+ |
|
67 |
|
class HostStatus |
68 |
|
{ |
69 |
|
private: |
70 |
|
multimap<string, string> cgi; |
71 |
< |
enum Format {page, table}; |
72 |
< |
Format format; |
71 |
> |
bool page; |
72 |
> |
bool host; |
73 |
> |
bool name; |
74 |
> |
bool address; |
75 |
> |
bool platform; |
76 |
> |
bool since; |
77 |
|
void parse(const string& method); |
78 |
+ |
void mode(); |
79 |
|
void display(const string& method); |
80 |
+ |
void header(const string& method); |
81 |
+ |
void footer(); |
82 |
|
public: |
83 |
|
HostStatus(); |
84 |
|
~HostStatus() {} |