78 |
|
|
79 |
|
void HostUpdate::display(CgiEnvironment& env) |
80 |
|
{ |
81 |
< |
cout << "Status: 401\nWWW-Authenticate: Basic realm=\"Host Update\"\n\n"; |
81 |
> |
cout << "Content-Type: text/plain\n\n"; |
82 |
> |
|
83 |
> |
set<Host> hosts; |
84 |
> |
DIR* dir = opendir("."); |
85 |
> |
struct dirent* ent; |
86 |
> |
|
87 |
> |
while ((ent = readdir(dir)) != NULL) |
88 |
> |
{ |
89 |
> |
string file = ent->d_name; |
90 |
> |
|
91 |
> |
cerr << file << '\n'; |
92 |
> |
|
93 |
> |
if (file == "." || file == "..") continue; |
94 |
> |
|
95 |
> |
Host host(file); |
96 |
> |
|
97 |
> |
hosts.insert(++host); |
98 |
> |
} |
99 |
> |
|
100 |
> |
closedir(dir); |
101 |
> |
|
102 |
> |
for (set<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++) |
103 |
> |
{ |
104 |
> |
Host host = *itor; |
105 |
> |
|
106 |
> |
cout << "host=" << host.getHost() << '\n' |
107 |
> |
<< "name=" << host.getName() << '\n' |
108 |
> |
<< "address=" << host.getAddress() << '\n' |
109 |
> |
<< "platform=" << host.getPlatform() << "\n\n"; |
110 |
> |
} |
111 |
|
} |