1 |
Douglas Thrift |
27 |
// Host Status |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _HostStatus_hpp_ |
8 |
|
|
#define _HostStatus_hpp_ |
9 |
|
|
|
10 |
Douglas Thrift |
32 |
#define _BSD_SOURCE |
11 |
|
|
|
12 |
Douglas Thrift |
27 |
#include <iostream> |
13 |
|
|
#include <string> |
14 |
|
|
#include <sstream> |
15 |
|
|
#include <map> |
16 |
|
|
#include <cstdlib> |
17 |
|
|
#include <ctime> |
18 |
|
|
|
19 |
|
|
#include <pstream.h> |
20 |
|
|
|
21 |
|
|
using namespace std; |
22 |
|
|
using namespace redi; |
23 |
|
|
|
24 |
|
|
inline string sgetenv(const string& name) |
25 |
|
|
{ |
26 |
|
|
char* value = getenv(name.c_str()); |
27 |
|
|
|
28 |
|
|
return value != NULL ? value : ""; |
29 |
|
|
} |
30 |
|
|
|
31 |
Douglas Thrift |
33 |
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 |
Douglas Thrift |
27 |
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
43 |
|
|
|
44 |
|
|
class HostStatus |
45 |
|
|
{ |
46 |
|
|
private: |
47 |
|
|
multimap<string, string> cgi; |
48 |
Douglas Thrift |
29 |
enum Format {page, table}; |
49 |
|
|
Format format; |
50 |
|
|
void parse(const string& method); |
51 |
|
|
void display(const string& method); |
52 |
Douglas Thrift |
27 |
public: |
53 |
|
|
HostStatus(); |
54 |
|
|
~HostStatus() {} |
55 |
|
|
}; |
56 |
|
|
|
57 |
|
|
#endif // _HostStatus_hpp_ |