6 |
|
|
7 |
|
#include "Host.hpp" |
8 |
|
|
9 |
< |
Host::Host(const string& host, const string& name, const string& address) |
9 |
> |
Host::Host(const string& host, const string& name, const string& address, const |
10 |
> |
string& platform) |
11 |
|
{ |
12 |
|
#ifdef _WIN32 |
13 |
|
if (count == 0) |
27 |
|
setHost(host); |
28 |
|
if (name != "") setName(name, address == ""); |
29 |
|
if (address != "") setAddress(address, name == ""); |
30 |
+ |
setPlatform(platform); |
31 |
|
} |
32 |
|
|
33 |
|
Host::~Host() |
76 |
|
|
77 |
|
if (lookup) |
78 |
|
{ |
77 |
– |
cerr << "Here!\n"; |
79 |
|
struct hostent* ent = gethostbyaddr((char*)(this->address), |
80 |
|
sizeof(in_addr), AF_INET); |
81 |
|
|
82 |
< |
name = ent->h_name; |
82 |
> |
if (ent != NULL) name = ent->h_name; |
83 |
|
} |
84 |
|
} |
85 |
|
|
88 |
|
ifstream fin(host.c_str()); |
89 |
|
|
90 |
|
getline(fin, name); |
90 |
– |
|
91 |
|
fin.read((char*)(address), sizeof(in_addr)); |
92 |
+ |
getline(fin, platform); |
93 |
|
fin.close(); |
94 |
|
} |
95 |
|
|
100 |
|
fout << name << '\n'; |
101 |
|
|
102 |
|
fout.write((char*)(address), sizeof(in_addr)); |
103 |
+ |
|
104 |
+ |
fout << platform; |
105 |
+ |
|
106 |
|
fout.close(); |
107 |
|
} |
108 |
|
|