ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Spectre/Mounter.cpp
Revision: 171
Committed: 2003-06-24T20:12:11-07:00 (22 years ago) by douglas
File size: 1225 byte(s)
Log Message:
Got started on Mounter.

File Contents

# Content
1 // Spectre Samba Mounter
2 //
3 // Douglas Thrift
4 //
5 // Mounter.cpp
6
7 #include "Mounter.h"
8
9 void Mounter::mount()
10 {
11 samba();
12
13 if (debug) cerr << "folders = {\n";
14
15 for (map<string, Folder>::iterator itor = folders.begin(); itor !=
16 folders.end(); itor++)
17 {
18 if (debug) cerr << " " << itor->first << " = {\n"
19 << " local = " << itor->second.local << "\n"
20 << " remote = " << itor->second.remote << "\n"
21 << " }\n";
22
23 mount(itor->first, itor->second.local);
24 }
25
26 if (debug) cerr << "}\n";
27 }
28
29 void Mounter::samba()
30 {
31 string path = config.root + "/" + host;
32
33 DIR* dir = opendir(path.c_str());
34
35 dirent* file;
36
37 while ((file = readdir(dir)) != NULL)
38 {
39 struct stat dir;
40 string folder = path + "/" + file->d_name;
41
42 stat(folder.c_str(), &dir);
43
44 if (S_ISDIR(dir.st_mode))
45 {
46 string folder = file->d_name;
47
48 if (folder == "." || folder == "..") continue;
49
50 string share = folder.find('.') == 0 ? folder.erase(0, 1) + "$" :
51 folder;
52
53 if (folders.find(share) == folders.end())
54 {
55 folders.insert(pair<string, Folder>(share, regular));
56 }
57 }
58 }
59
60 closedir(dir);
61 }
62
63 void Mounter::samba(ipstream& pin)
64 {
65 //
66 }
67
68 void Mounter::mount(const string& folder, const string& user)
69 {
70 //
71 }