7 |
|
#ifndef _HostStatus_hpp_ |
8 |
|
#define _HostStatus_hpp_ |
9 |
|
|
10 |
+ |
#define _BSD_SOURCE |
11 |
+ |
|
12 |
|
#include <iostream> |
13 |
|
#include <string> |
14 |
|
#include <sstream> |
15 |
+ |
#include <list> |
16 |
+ |
#include <set> |
17 |
|
#include <map> |
18 |
|
#include <cstdlib> |
19 |
|
#include <ctime> |
30 |
|
return value != NULL ? value : ""; |
31 |
|
} |
32 |
|
|
33 |
< |
inline int sputenv(const string& name) { return putenv(name.c_str()); } |
33 |
> |
inline int sputenv(const string& name) |
34 |
> |
{ |
35 |
> |
char* value = new char[name.size() + 1]; |
36 |
> |
|
37 |
> |
sprintf(value, name.c_str()); |
38 |
> |
|
39 |
> |
int code = putenv(value); |
40 |
> |
|
41 |
> |
return code; |
42 |
> |
} |
43 |
> |
|
44 |
|
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
45 |
|
|
46 |
|
class HostStatus |
47 |
|
{ |
48 |
|
private: |
49 |
|
multimap<string, string> cgi; |
50 |
< |
void parse(); |
50 |
> |
bool page; |
51 |
> |
bool host; |
52 |
> |
bool name; |
53 |
> |
bool address; |
54 |
> |
bool platform; |
55 |
> |
bool since; |
56 |
> |
void parse(const string& method); |
57 |
|
void mode(); |
58 |
< |
void display(); |
58 |
> |
void display(const string& method); |
59 |
> |
void header(const string& method); |
60 |
> |
void footer(); |
61 |
|
public: |
62 |
|
HostStatus(); |
63 |
|
~HostStatus() {} |