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 <map> |
17 |
|
#include <cstdlib> |
18 |
|
#include <ctime> |
29 |
|
return value != NULL ? value : ""; |
30 |
|
} |
31 |
|
|
32 |
< |
inline int sputenv(const string& name) { return putenv(name.c_str()); } |
32 |
> |
inline int sputenv(const string& name) |
33 |
> |
{ |
34 |
> |
char* value = new char[name.size() + 1]; |
35 |
> |
|
36 |
> |
sprintf(value, name.c_str()); |
37 |
> |
|
38 |
> |
int code = putenv(value); |
39 |
> |
|
40 |
> |
return code; |
41 |
> |
} |
42 |
> |
|
43 |
|
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
44 |
|
|
45 |
|
class HostStatus |
46 |
|
{ |
47 |
|
private: |
48 |
|
multimap<string, string> cgi; |
49 |
< |
enum Format {page, table}; |
37 |
< |
Format format; |
49 |
> |
bool page; |
50 |
|
void parse(const string& method); |
51 |
|
void display(const string& method); |
52 |
+ |
void header(); |
53 |
+ |
void footer(); |
54 |
|
public: |
55 |
|
HostStatus(); |
56 |
|
~HostStatus() {} |