6 |
|
|
7 |
|
#include "HostUpdate.hpp" |
8 |
|
#include "Host.hpp" |
9 |
+ |
|
10 |
+ |
#ifdef _WIN32 |
11 |
|
#include <windows.h> |
12 |
+ |
#endif |
13 |
|
|
14 |
|
int main(int argc, char* argv[]) |
15 |
|
{ |
45 |
|
} |
46 |
|
} |
47 |
|
|
45 |
– |
HostUpdate::~HostUpdate() |
46 |
– |
{ |
47 |
– |
// |
48 |
– |
} |
49 |
– |
|
48 |
|
void HostUpdate::parse(const string& method) |
49 |
|
{ |
50 |
|
string query; |
143 |
|
|
144 |
|
for (set<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++) |
145 |
|
{ |
146 |
< |
Host host = *itor; |
146 |
> |
display(*itor); |
147 |
> |
} |
148 |
> |
} |
149 |
|
|
150 |
< |
cout << "host=" << host.getHost() << '\n' |
151 |
< |
<< "name=" << host.getName() << '\n' |
152 |
< |
<< "address=" << host.getAddress() << '\n' |
153 |
< |
<< "platform=" << host.getPlatform() << '\n'; |
150 |
> |
void HostUpdate::display(const Host& host) |
151 |
> |
{ |
152 |
> |
cout << "host=" << host.getHost() << '\n' |
153 |
> |
<< "name=" << host.getName() << '\n' |
154 |
> |
<< "address=" << host.getAddress() << '\n' |
155 |
> |
<< "platform=" << host.getPlatform() << '\n'; |
156 |
|
|
157 |
< |
string name = string("hosts") + slash + host.getHost(); |
158 |
< |
struct stat file; |
157 |
> |
string name = string("hosts") + slash + host.getHost(); |
158 |
> |
struct stat file; |
159 |
|
|
160 |
< |
if (stat(name.c_str(), &file) == 0) |
161 |
< |
{ |
162 |
< |
char since[20]; |
160 |
> |
if (stat(name.c_str(), &file) == 0) |
161 |
> |
{ |
162 |
> |
char since[20]; |
163 |
|
|
164 |
< |
strftime(since, 20, "%m/%d/%Y %H:%M:%S", gmtime(&file.st_mtime)); |
164 |
> |
strftime(since, 20, "%m/%d/%Y %H:%M:%S", gmtime(&file.st_mtime)); |
165 |
|
|
166 |
< |
cout << "since=" << since << " GMT\n"; |
165 |
< |
} |
166 |
> |
cout << "since=" << since << " GMT\n"; |
167 |
|
} |
168 |
|
} |