42 |
|
} |
43 |
|
} |
44 |
|
|
45 |
– |
HostUpdate::~HostUpdate() |
46 |
– |
{ |
47 |
– |
// |
48 |
– |
} |
49 |
– |
|
45 |
|
void HostUpdate::parse(const string& method) |
46 |
|
{ |
47 |
|
string query; |
140 |
|
|
141 |
|
for (set<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++) |
142 |
|
{ |
143 |
< |
Host host = *itor; |
143 |
> |
display(*itor); |
144 |
> |
} |
145 |
> |
} |
146 |
> |
|
147 |
> |
void HostUpdate::display(const Host& host) |
148 |
> |
{ |
149 |
> |
cout << "host=" << host.getHost() << '\n' |
150 |
> |
<< "name=" << host.getName() << '\n' |
151 |
> |
<< "address=" << host.getAddress() << '\n' |
152 |
> |
<< "platform=" << host.getPlatform() << '\n'; |
153 |
> |
|
154 |
> |
string name = string("hosts") + slash + host.getHost(); |
155 |
> |
struct stat file; |
156 |
> |
|
157 |
> |
if (stat(name.c_str(), &file) == 0) |
158 |
> |
{ |
159 |
> |
char since[20]; |
160 |
> |
|
161 |
> |
strftime(since, 20, "%m/%d/%Y %H:%M:%S", gmtime(&file.st_mtime)); |
162 |
|
|
163 |
< |
cout << "host=" << host.getHost() << '\n' |
151 |
< |
<< "name=" << host.getName() << '\n' |
152 |
< |
<< "address=" << host.getAddress() << '\n' |
153 |
< |
<< "platform=" << host.getPlatform() << "\n\n"; |
163 |
> |
cout << "since=" << since << " GMT\n"; |
164 |
|
} |
165 |
|
} |