2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: Spectre.cpp,v 1.12 2003/07/31 00:56:29 douglas Exp $ |
5 |
> |
// $Id: Spectre.cpp,v 1.13 2003/07/31 04:14:12 douglas Exp $ |
6 |
|
|
7 |
|
#include "Spectre.h" |
8 |
|
#include "Maker.h" |
433 |
|
|
434 |
|
void autounmount(set<string>& unmounts) |
435 |
|
{ |
436 |
< |
// |
436 |
> |
vector<string> args; |
437 |
> |
|
438 |
> |
args.push_back("spectre"); |
439 |
> |
|
440 |
> |
ipstream findsmb(config.findsmb, args); |
441 |
> |
|
442 |
> |
if (debug) cerr << "findsmb = {\n"; |
443 |
> |
|
444 |
> |
do |
445 |
> |
{ |
446 |
> |
if (isdigit(findsmb.peek())) break; |
447 |
> |
|
448 |
> |
string line; |
449 |
> |
|
450 |
> |
getline(findsmb, line); |
451 |
> |
|
452 |
> |
if (debug) cerr << line << "\n"; |
453 |
> |
} |
454 |
> |
while (findsmb.good()); |
455 |
> |
|
456 |
> |
set<string> hosts; |
457 |
> |
|
458 |
> |
automake(hosts, findsmb); |
459 |
> |
|
460 |
> |
if (debug) cerr << "}\n"; |
461 |
> |
|
462 |
> |
findsmb.close(); |
463 |
> |
|
464 |
> |
for (multimap<string, string>::iterator itor = config.hosts.begin(); itor |
465 |
> |
!= config.hosts.end(); itor = config.hosts.upper_bound(itor->first)) |
466 |
> |
{ |
467 |
> |
string host = itor->first; |
468 |
> |
|
469 |
> |
if (hosts.find(host) != hosts.end()) continue; |
470 |
> |
|
471 |
> |
unmounts.insert(host); |
472 |
> |
} |
473 |
> |
|
474 |
> |
if (debug) |
475 |
> |
{ |
476 |
> |
cerr << "unmounts = {\n"; |
477 |
> |
|
478 |
> |
for (set<string>::iterator itor = unmounts.begin(); itor != |
479 |
> |
unmounts.end(); itor++) |
480 |
> |
{ |
481 |
> |
cerr << " " << *itor << "\n"; |
482 |
> |
} |
483 |
> |
|
484 |
> |
cerr << "}\n"; |
485 |
> |
} |
486 |
|
} |
487 |
|
|
488 |
|
void configure() |
519 |
|
{ |
520 |
|
config.mount = line.substr(6); |
521 |
|
} |
522 |
+ |
else if (line.find("umount=") == 0) |
523 |
+ |
{ |
524 |
+ |
config.umount = line.substr(7); |
525 |
+ |
} |
526 |
|
else if (line.find("root=") == 0) |
527 |
|
{ |
528 |
|
config.root = line.substr(5); |