29 FILE *dirtab_file = fopen(dirtab_path.c_str(),
"r");
30 if (dirtab_file == NULL) {
32 "Cannot open dirtab for reading at '%s' "
34 dirtab_path.c_str(), errno);
46 off_t line_offset = 0;
47 while (line_offset < static_cast<off_t>(dirtab.size())) {
48 std::string line =
GetLineMem(dirtab.c_str() + line_offset,
49 dirtab.size() - line_offset);
50 line_offset += line.size() + 1;
77 std::string::const_iterator itr = line.begin();
78 const std::string::const_iterator iend = line.end();
79 bool negation =
false;
92 std::string pathspec_str(
Trim(std::string(itr, iend)));
97 if (pathspec_str.empty()) {
109 const Rule rule(pathspec, negation);
128 for (; p != pend; ++p) {
132 for (; n != nend; ++n) {
134 if (p->pathspec == n->pathspec) {
146 bool has_positive_match =
false;
149 for (; p != pend; ++p) {
151 if (p->pathspec.IsMatching(path)) {
152 has_positive_match =
true;
157 return has_positive_match && !
IsOpposing(path);
164 for (; n != nend; ++n) {
166 if (n->pathspec.IsMatchingRelaxed(path)) {
virtual bool IsMatching(const std::string &path) const
string GetLineMem(const char *text, const int text_size)
bool Open(const std::string &dirtab_path)
string Trim(const string &raw, bool trim_newline)
void SkipWhitespace(const std::string::const_iterator &end, std::string::const_iterator *itr) const
bool ParseLine(const std::string &line)
assert((mem||(size==0))&&"Out Of Memory")
static const char kCommentMarker
virtual bool IsOpposing(const std::string &path) const
bool FileExists(const std::string &path)
bool GetLineFile(FILE *f, std::string *line)
virtual bool ParsePathspec(const std::string &pathspec_str, bool negation)
void AddRule(const Rule &rule)
virtual bool Parse(const std::string &dirtab)
bool CheckRuleValidity() const
static const char kNegationMarker
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)