1 #ifndef FILES_H
2 #define FILES_H
3 
4 #include <map>
5 #include <string>
6 #include <vector>
7 #include <sys/types.h>
8 
9 using namespace std;
10 
11 enum FileOpType {
12     FILE_OP_COPY = 0,
13     FILE_OP_REMOVE,
14     FILE_OP_STRIP
15 };
16 
17 struct FileRecord
18 {
19     FileRecord();
20 
21     string listFile;
22     int listLine;
23 
24     string sourceBase;
25     string sourceName;
26     string sourcePath;
27     bool sourceIsDir;
28     time_t sourceMod;
29     off_t  sourceSize;
30     FileOpType fileOp;
31 
32     string outName;
33     string outPath;
34     off_t  outSize;
35     time_t outMod;
36     bool outIsDir;
37     unsigned int mode;
38 };
39 
40 int read_list_file(const string& filename,
41                    const map<string, string>& variables,
42                    vector<FileRecord>* files,
43                    vector<string>* excludes);
44 int locate(FileRecord* rec, const vector<string>& search);
45 void stat_out(const string& base, FileRecord* rec);
46 string dir_part(const string& filename);
47 int list_dir(const FileRecord& rec, const vector<string>& excludes,
48                     vector<FileRecord>* files);
49 
50 #endif // FILES_H
51