10 |
|
#include <iostream> |
11 |
|
#include <fstream> |
12 |
|
#include <string> |
13 |
+ |
#include <sstream> |
14 |
|
#include <set> |
15 |
< |
#include <cgicc/Cgicc.h> |
15 |
> |
#include <map> |
16 |
> |
#include <cstdlib> |
17 |
> |
#include <ctime> |
18 |
> |
#include <cstring> |
19 |
|
|
20 |
|
#include <sys/types.h> |
21 |
|
#include <sys/stat.h> |
25 |
|
#include <unistd.h> |
26 |
|
#include <dirent.h> |
27 |
|
|
28 |
+ |
const char slash = '/'; |
29 |
+ |
|
30 |
|
inline int mkdir(const char* path) |
31 |
|
{ |
32 |
< |
return mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR); |
32 |
> |
return ::mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR); |
33 |
|
} |
34 |
|
|
35 |
|
#else |
36 |
|
|
37 |
|
#include <direct.h> |
38 |
|
|
39 |
+ |
const char slash = '\\'; |
40 |
+ |
|
41 |
|
#endif |
42 |
|
|
43 |
< |
using namespace std; |
44 |
< |
using namespace cgicc; |
43 |
> |
inline std::string sgetenv(const std::string& name) |
44 |
> |
{ |
45 |
> |
char* value = ::getenv(name.c_str()); |
46 |
> |
|
47 |
> |
return value != NULL ? value : ""; |
48 |
> |
} |
49 |
> |
|
50 |
> |
class Host; |
51 |
|
|
52 |
|
class HostUpdate |
53 |
|
{ |
54 |
|
private: |
55 |
< |
Cgicc cgi; |
56 |
< |
void update(CgiEnvironment& env, const string& agent); |
57 |
< |
void display(CgiEnvironment& env); |
55 |
> |
std::multimap<std::string, std::string> cgi; |
56 |
> |
bool host; |
57 |
> |
bool name; |
58 |
> |
bool address; |
59 |
> |
bool platform; |
60 |
> |
bool since; |
61 |
> |
void parse(const std::string& method); |
62 |
> |
void mode(); |
63 |
> |
void update(const std::string& agent); |
64 |
> |
void display(); |
65 |
> |
void display(const Host& host); |
66 |
|
public: |
67 |
|
HostUpdate(); |
68 |
< |
~HostUpdate(); |
68 |
> |
~HostUpdate() {} |
69 |
|
}; |
70 |
|
|
71 |
|
#endif // _HostUpdate_hpp_ |