1 |
// Spectre Samba Mounter |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// Spectre.h |
6 |
|
7 |
#ifndef _Spectre_h_ |
8 |
#define _Spectre_h_ |
9 |
|
10 |
#include <iostream> |
11 |
#include <fstream> |
12 |
#include <string> |
13 |
#include <sstream> |
14 |
#include <vector> |
15 |
#include <set> |
16 |
#include <map> |
17 |
#include <cstdlib> |
18 |
#include <cstdio> |
19 |
#include <cctype> |
20 |
|
21 |
#include <pstream.h> |
22 |
#include <sys/utsname.h> |
23 |
#include <sys/types.h> |
24 |
#include <sys/stat.h> |
25 |
#include <dirent.h> |
26 |
#include <pwd.h> |
27 |
#include <unistd.h> |
28 |
|
29 |
using namespace std; |
30 |
using namespace redi; |
31 |
|
32 |
struct Config |
33 |
{ |
34 |
string install; |
35 |
string findsmb; |
36 |
string smbclient; |
37 |
string mount; |
38 |
string root; |
39 |
multimap<string, string> hosts; |
40 |
}; |
41 |
|
42 |
extern string program; |
43 |
extern string programName; |
44 |
extern string programVersion; |
45 |
extern bool debug; |
46 |
|
47 |
extern Config config; |
48 |
|
49 |
string platform(); |
50 |
void usage(); |
51 |
void version(); |
52 |
|
53 |
inline string toupper(const string& lower) |
54 |
{ |
55 |
string upper; |
56 |
|
57 |
for (unsigned index = 0; index < lower.length(); index++) |
58 |
{ |
59 |
upper += toupper(lower[index]); |
60 |
} |
61 |
|
62 |
return upper; |
63 |
} |
64 |
|
65 |
inline string tolower(const string& upper) |
66 |
{ |
67 |
string lower; |
68 |
|
69 |
for (unsigned index = 0; index < upper.length(); index++) |
70 |
{ |
71 |
lower += tolower(upper[index]); |
72 |
} |
73 |
|
74 |
return lower; |
75 |
} |
76 |
|
77 |
inline void strip(char* name) |
78 |
{ |
79 |
for (unsigned index = strlen(name); index > 0; index--) |
80 |
{ |
81 |
if (name[index - 1] == ' ') |
82 |
{ |
83 |
name[index - 1] = '\0'; |
84 |
} |
85 |
else |
86 |
{ |
87 |
break; |
88 |
} |
89 |
} |
90 |
} |
91 |
|
92 |
#endif // _Spectre_h_ |