mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
parent
e0f0bb53f7
commit
12f393a55e
32 changed files with 569 additions and 122 deletions
28
src/str.cpp
28
src/str.cpp
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue