29 FILE *dirtab_file = fopen(dirtab_path.c_str(),
"r");
30 if (dirtab_file == NULL) {
33 dirtab_path.c_str(), errno);
45 off_t line_offset = 0;
46 while (line_offset < static_cast<off_t>(dirtab.size())) {
47 std::string line =
GetLineMem(dirtab.c_str() + line_offset,
48 dirtab.size() - line_offset);
49 line_offset += line.size() + 1;
76 std::string::const_iterator itr = line.begin();
77 const std::string::const_iterator iend = line.end();
78 bool negation =
false;
91 std::string pathspec_str(
Trim(std::string(itr, iend)));
96 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,...)