7 |
|
#ifndef _HostStatus_hpp_ |
8 |
|
#define _HostStatus_hpp_ |
9 |
|
|
10 |
+ |
#define _BSD_SOURCE |
11 |
+ |
|
12 |
|
#include <iostream> |
13 |
|
#include <string> |
14 |
|
#include <sstream> |
28 |
|
return value != NULL ? value : ""; |
29 |
|
} |
30 |
|
|
31 |
< |
inline int sputenv(const string& name) { return putenv(name.c_str()); } |
31 |
> |
inline int sputenv(const string& name) |
32 |
> |
{ |
33 |
> |
char* value = new char[name.size() + 1]; |
34 |
> |
|
35 |
> |
sprintf(value, name.c_str()); |
36 |
> |
|
37 |
> |
int code = putenv(value); |
38 |
> |
|
39 |
> |
return code; |
40 |
> |
} |
41 |
> |
|
42 |
|
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
43 |
|
|
44 |
|
class HostStatus |
45 |
|
{ |
46 |
|
private: |
47 |
|
multimap<string, string> cgi; |
48 |
< |
void parse(); |
49 |
< |
void mode(); |
50 |
< |
void display(); |
48 |
> |
enum Format {page, table}; |
49 |
> |
Format format; |
50 |
> |
void parse(const string& method); |
51 |
> |
void display(const string& method); |
52 |
|
public: |
53 |
|
HostStatus(); |
54 |
|
~HostStatus() {} |