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

Comparing trunk/Spectre/Spectre.cpp (file contents):
Revision 177 by douglas, 2003-07-05T18:09:20-07:00 vs.
Revision 226 by douglas, 2003-07-30T16:29:00-07:00

# Line 10 | Line 10
10  
11   string program;
12   string programName = "Spectre Samba Mounter";
13 < string programVersion = "1.0beta";
13 > string programVersion = "1.0rc1";
14   bool debug = false;
15  
16   Config config;
# Line 239 | Line 239 | void automake(set<string>& makes)
239  
240          if (debug) cerr << "findsmb = {\n";
241  
242 <        for (unsigned index = 0; index < 5; index++)
242 >        do
243          {
244 +                if (isdigit(findsmb.peek())) break;
245 +
246                  string line;
247  
248                  getline(findsmb, line);
249  
250                  if (debug) cerr << line << "\n";
251          }
252 +        while (findsmb.good());
253  
254          automake(makes, findsmb);
255  
# Line 275 | Line 278 | void automake(set<string>& makes, ipstre
278                  if (!isdigit(pin.peek())) break;
279  
280                  char ip[17];
281 <                char host[16];
281 >                string tab;
282 >                char host[15];
283                  string info;
284  
285                  pin.get(ip, 17);
286 <                pin.ignore();
287 <                pin.get(host, 16);
286 >
287 >                while (isspace(pin.peek()))
288 >                {
289 >                        tab += pin.get();
290 >                }
291 >
292 >                pin.get(host, 15);
293                  getline(pin, info);
294  
295 <                if (debug) cerr << ip << "\t" << host << info << "\n";
295 >                if (debug) cerr << ip << tab << host << info << "\n";
296  
297                  strip(host);
298  
# Line 304 | Line 313 | void automake(set<string>& makes, ipstre
313  
314   void automount(set<string>& mounts)
315   {
316 +        vector<string> args;
317 +
318 +        args.push_back("spectre");
319 +        
320 +        ipstream findsmb(config.findsmb, args);
321 +
322 +        if (debug) cerr << "findsmb = {\n";
323 +
324 +        do
325 +        {
326 +                if (isdigit(findsmb.peek())) break;
327 +
328 +                string line;
329 +
330 +                getline(findsmb, line);
331 +
332 +                if (debug) cerr << line << "\n";
333 +        }
334 +        while (findsmb.good());
335 +
336 +        set<string> hosts;
337 +        
338 +        automake(hosts, findsmb);
339 +
340 +        if (debug) cerr << "}\n";
341 +
342 +        findsmb.close();
343 +
344          DIR* dir = opendir(config.root.c_str());
345          dirent* file;
346  
# Line 318 | Line 355 | void automount(set<string>& mounts)
355                  {
356                          string folder = file->d_name;
357  
358 <                        if (folder == "." || folder == "..") continue;
358 >                        if (folder == "." || folder == ".." || hosts.find(folder) ==
359 >                                hosts.end()) continue;
360  
361                          mounts.insert(folder);
362                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines