per FUSE function policies. closes #52, #53

This commit is contained in:
Antonio SJ Musumeci 2015-02-19 09:09:24 -05:00
parent e0f0bb53f7
commit 12f393a55e
32 changed files with 569 additions and 122 deletions

View file

@ -26,6 +26,8 @@
#include <vector>
#include <sstream>
#include <fnmatch.h>
using std::string;
using std::vector;
using std::istringstream;
@ -111,4 +113,30 @@ namespace str
return str::join(vec,idx,sep);
}
void
erase_fnmatches(const vector<string> &patterns,
vector<string> &strs)
{
vector<string>::iterator si;
vector<string>::const_iterator pi;
si = strs.begin();
while(si != strs.end())
{
int match = FNM_NOMATCH;
for(pi = patterns.begin();
pi != patterns.end() && match != 0;
++pi)
{
match = fnmatch(pi->c_str(),si->c_str(),0);
}
if(match == 0)
si = strs.erase(si);
else
++si;
}
}
}