6 |
|
|
7 |
|
#include "Host.hpp" |
8 |
|
|
9 |
– |
#ifndef _WIN32 |
10 |
– |
|
11 |
– |
static char slash = '/'; |
12 |
– |
|
13 |
– |
#else |
14 |
– |
|
15 |
– |
static char slash = '\\'; |
16 |
– |
|
17 |
– |
#endif |
18 |
– |
|
9 |
|
Host::Host(const string& host, const string& name, const string& address, const |
10 |
|
string& platform) |
11 |
|
{ |
63 |
|
if (value == INADDR_NONE) |
64 |
|
{ |
65 |
|
cerr << "Host.setAddress(): INADDR_NONE\n"; |
76 |
– |
exit(1); |
66 |
|
} |
67 |
|
else |
68 |
|
{ |
115 |
|
getline(fin, name); |
116 |
|
|
117 |
|
string address; |
118 |
< |
|
118 |
> |
|
119 |
|
getline(fin, address); |
120 |
|
|
121 |
|
in_addr_t value = inet_addr(address.c_str()); |
123 |
|
if (value == INADDR_NONE) |
124 |
|
{ |
125 |
|
cerr << "Host.operator++(): INADDR_NONE\n"; |
137 |
– |
exit(1); |
126 |
|
} |
127 |
|
else |
128 |
|
{ |
148 |
|
Host Host::operator--() |
149 |
|
{ |
150 |
|
string file = string("hosts") + slash + host; |
151 |
< |
|
151 |
> |
|
152 |
|
ofstream fout(file.c_str()); |
153 |
|
|
154 |
|
fout << name << '\n' |