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

Comparing CCSFinger/CCSFinger.cpp (file contents):
Revision 617 by douglas, 2005-12-13T01:35:20-08:00 vs.
Revision 618 by douglas, 2005-12-13T02:23:55-08:00

# Line 5 | Line 5
5   // Windows Finger Daemon
6  
7   #include <windows.h>
8 #include <tchar.h>
9 #include <signal.h>
10 #include <wtsapi32.h>
8   #include <lm.h>
9 + #include <signal.h>
10 + #include <tchar.h>
11   #include <shlobj.h>
12 + #include <wtsapi32.h>
13  
14   #include <algorithm>
15 < #include <iostream>
15 > #include <cctype>
16 > #include <cwctype>
17 > #include <fstream>
18   #include <iomanip>
19 < #include <string>
19 > #include <iostream>
20 > #include <map>
21   #include <sstream>
22 + #include <string>
23   #include <vector>
20 #include <map>
21 #include <cwctype>
24  
25   std::ostream &operator<<(std::ostream &out, WTS_CONNECTSTATE_CLASS status)
26   {
# Line 144 | Line 146 | class Finger
146          {
147                  for (std::multimap<std::string, Login>::const_iterator login(logins.begin()); login != logins.end(); login = logins.upper_bound(login->first))
148                  {
149 <                        stream << "Login: " << login->first << std::string(33 - login->first.size(), ' ') << "Name: " << login->second.GetName() << "\r\nDirectory: " << login->second.GetDirectory() << "\r\n";
149 >                        std::string directory(login->second.GetDirectory());
150 >
151 >                        stream << "Login: " << login->first << std::string(33 - login->first.size(), ' ') << "Name: " << login->second.GetName() << "\r\nDirectory: " << directory << "\r\n";
152 >
153 >                        for (std::multimap<std::string, Login>::const_iterator login_(logins.lower_bound(login->first)); login_ != logins.upper_bound(login->first); ++login_)
154 >                                stream << login_->second.status << ' ' << login_->second.session << ' ' << login_->second.id << "\r\n";
155 >
156 >                        std::string files[] = { "\\.project", "\\.plan" };
157 >
158 >                        for (std::string *file(files); file != files + sizeof (files) / sizeof (*file); ++file)
159 >                        {
160 >                                file->insert(0, directory);
161 >
162 >                                std::ifstream in(file->c_str());
163 >
164 >                                if (!in.is_open())
165 >                                        continue;
166 >
167 >                                switch (file - files)
168 >                                {
169 >                                case 0:
170 >                                        stream << "Project:\r\n";
171 >
172 >                                        break;
173 >                                case 1:
174 >                                        stream << "Plan:\r\n";
175 >                                }
176 >
177 >                                std::string buffer;
178 >
179 >                                while (std::getline(in, buffer))
180 >                                        stream << buffer << std::endl;
181 >                        }
182                  }
183          }
184  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines