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

Comparing HostUpdate/HostUpdate.cpp (file contents):
Revision 15 by Douglas Thrift, 2003-11-09T16:51:42-08:00 vs.
Revision 17 by Douglas Thrift, 2003-11-10T11:08:33-08:00

# Line 6 | Line 6
6  
7   #include "HostUpdate.hpp"
8   #include "Host.hpp"
9 + #include <windows.h>
10  
11   int main(int argc, char* argv[])
12   {
# Line 80 | Line 81 | void HostUpdate::update(const string& ag
81          cout << "Content-Type: text/plain\n\n";
82  
83          multimap<string, string>::iterator itor = cgi.find("host");
84 <        
84 >
85          if (itor == cgi.end()) return;
86          if (itor->second == "") return;
87  
# Line 106 | Line 107 | void HostUpdate::display()
107          cout << "Content-Type: text/plain\n\n";
108  
109          set<Host> hosts;
110 +
111 + #ifndef _WIN32
112          DIR* dir = opendir("hosts");
113          struct dirent* ent;
114  
# Line 114 | Line 117 | void HostUpdate::display()
117                  string file = ent->d_name;
118  
119                  if (file == "." || file == "..") continue;
120 <                
120 >
121                  Host host(file);
122  
123                  hosts.insert(++host);
124          }
125  
126          closedir(dir);
127 + #else
128 +        WIN32_FIND_DATA found;
129 +        HANDLE find = FindFirstFile("hosts\\*", &found);
130 +
131 +        do
132 +        {
133 +                string file = found.cFileName;
134 +
135 +                if (file == "." || file == "..") continue;
136 +
137 +                Host host(file);
138 +
139 +                hosts.insert(++host);
140 +        }
141 +        while (FindNextFile(find, &found) != 0);
142 +
143 +        FindClose(find);
144 + #endif
145  
146          for (set<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++)
147          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines