|
a/src/utils/fstreewalk.cpp |
|
b/src/utils/fstreewalk.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.10 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.11 2007-02-02 10:12:58 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
88 |
data->skippedNames.sort();
|
88 |
data->skippedNames.sort();
|
89 |
data->skippedNames.unique();
|
89 |
data->skippedNames.unique();
|
90 |
return true;
|
90 |
return true;
|
91 |
}
|
91 |
}
|
92 |
|
92 |
|
93 |
bool FsTreeWalker::addSkippedPath(const string& path)
|
93 |
bool FsTreeWalker::addSkippedPath(const string& ipath)
|
94 |
{
|
94 |
{
|
|
|
95 |
string path = path_canon(ipath);
|
95 |
if (find(data->skippedPaths.begin(),
|
96 |
if (find(data->skippedPaths.begin(),
|
96 |
data->skippedPaths.end(), path) == data->skippedPaths.end())
|
97 |
data->skippedPaths.end(), path) == data->skippedPaths.end())
|
97 |
data->skippedPaths.push_back(path_canon(path));
|
98 |
data->skippedPaths.push_back(path);
|
98 |
return true;
|
99 |
return true;
|
99 |
}
|
100 |
}
|
100 |
bool FsTreeWalker::setSkippedPaths(const list<string> &paths)
|
101 |
bool FsTreeWalker::setSkippedPaths(const list<string> &paths)
|
101 |
{
|
102 |
{
|
102 |
data->skippedPaths = paths;
|
103 |
data->skippedPaths = paths;
|
|
... |
|
... |
179 |
lstat(fn.c_str(), &st);
|
180 |
lstat(fn.c_str(), &st);
|
180 |
if (statret == -1) {
|
181 |
if (statret == -1) {
|
181 |
data->logsyserr("stat", fn);
|
182 |
data->logsyserr("stat", fn);
|
182 |
continue;
|
183 |
continue;
|
183 |
}
|
184 |
}
|
|
|
185 |
if (!data->skippedPaths.empty()) {
|
|
|
186 |
list<string>::const_iterator it;
|
|
|
187 |
for (it = data->skippedPaths.begin();
|
|
|
188 |
it != data->skippedPaths.end(); it++) {
|
|
|
189 |
if (fnmatch(it->c_str(), fn.c_str(), FNM_PATHNAME) == 0)
|
|
|
190 |
goto skip;
|
|
|
191 |
}
|
|
|
192 |
}
|
|
|
193 |
|
184 |
if (S_ISDIR(st.st_mode)) {
|
194 |
if (S_ISDIR(st.st_mode)) {
|
185 |
if (!data->skippedPaths.empty()) {
|
|
|
186 |
list<string>::const_iterator it;
|
|
|
187 |
for (it = data->skippedPaths.begin();
|
|
|
188 |
it != data->skippedPaths.end(); it++) {
|
|
|
189 |
if (fn == *it)
|
|
|
190 |
goto skip;
|
|
|
191 |
}
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
if (data->options & FtwNoRecurse) {
|
195 |
if (data->options & FtwNoRecurse) {
|
195 |
status = cb.processone(fn, &st, FtwDirEnter);
|
196 |
status = cb.processone(fn, &st, FtwDirEnter);
|
196 |
} else {
|
197 |
} else {
|
197 |
status = iwalk(fn, cb);
|
198 |
status = iwalk(fn, cb);
|
198 |
}
|
199 |
}
|