ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/Host.cpp
(Generate patch)

Comparing HostUpdate/Host.cpp (file contents):
Revision 11 by Douglas Thrift, 2003-11-06T20:37:52-08:00 vs.
Revision 12 by Douglas Thrift, 2003-11-06T23:43:01-08:00

# Line 6 | Line 6
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)
# Line 26 | Line 27 | Host::Host(const string& host, const str
27          setHost(host);
28          if (name != "") setName(name, address == "");
29          if (address != "") setAddress(address, name == "");
30 +        setPlatform(platform);
31   }
32  
33   Host::~Host()
# Line 74 | Line 76 | void Host::setAddress(const string& addr
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  
# Line 87 | Line 88 | void Host::operator++()
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  
# Line 99 | Line 100 | void Host::operator--()
100          fout << name << '\n';
101  
102          fout.write((char*)(address), sizeof(in_addr));
103 +
104 +        fout << platform;
105 +
106          fout.close();
107   }
108  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines