ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Spectre/Spectre.h
Revision: 227
Committed: 2003-07-30T17:56:29-07:00 (21 years, 11 months ago) by douglas
Content type: text/x-c
File size: 1369 byte(s)
Log Message:
Thought about the meaning of life, added $Id$ tags.

File Contents

# User Rev Content
1 douglas 148 // 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 douglas 159 #include <fstream>
12 douglas 162 #include <string>
13     #include <sstream>
14 douglas 148 #include <vector>
15     #include <set>
16 douglas 153 #include <map>
17 douglas 148 #include <cstdlib>
18     #include <cstdio>
19 douglas 176 #include <cctype>
20 douglas 148
21     #include <pstream.h>
22 douglas 155 #include <sys/utsname.h>
23 douglas 148 #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 douglas 154 struct Config
33     {
34     string install;
35 douglas 176 string findsmb;
36 douglas 154 string smbclient;
37 douglas 159 string mount;
38 douglas 227 string umount;
39 douglas 154 string root;
40 douglas 155 multimap<string, string> hosts;
41 douglas 154 };
42    
43 douglas 153 extern string program;
44     extern string programName;
45     extern string programVersion;
46     extern bool debug;
47    
48 douglas 154 extern Config config;
49    
50 douglas 155 string platform();
51 douglas 153 void usage();
52     void version();
53    
54 douglas 176 inline string toupper(const string& lower)
55     {
56     string upper;
57    
58     for (unsigned index = 0; index < lower.length(); index++)
59     {
60     upper += toupper(lower[index]);
61     }
62    
63     return upper;
64     }
65    
66     inline string tolower(const string& upper)
67     {
68     string lower;
69    
70     for (unsigned index = 0; index < upper.length(); index++)
71     {
72     lower += tolower(upper[index]);
73     }
74    
75     return lower;
76     }
77    
78     inline void strip(char* name)
79     {
80     for (unsigned index = strlen(name); index > 0; index--)
81     {
82     if (name[index - 1] == ' ')
83     {
84     name[index - 1] = '\0';
85     }
86     else
87     {
88     break;
89     }
90     }
91     }
92    
93 douglas 148 #endif // _Spectre_h_