summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-01-13 14:51:28 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-01-13 14:51:28 +0100
commitbe4eec613e34a43f34eb9a9b227b69a58fe66ec8 (patch)
treeffc2b4d427c95558bbfe8e0202724004751c5ad0 /apt-pkg/contrib
parentf45fd56b58a71f2827eb8b4f96333782d84b7b63 (diff)
parent72f6c6f8d9b1a92c7795ffcfbdc3b8858eb79a70 (diff)
merge with lp:~mvo/apt/debian-sid to get 0.7.25.1 and my changes back
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/configuration.cc4
-rw-r--r--apt-pkg/contrib/fileutl.cc65
-rw-r--r--apt-pkg/contrib/fileutl.h2
3 files changed, 37 insertions, 34 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 89aa854a3..80b089fac 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -829,8 +829,8 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio
// ReadConfigDir - Read a directory of config files /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool ReadConfigDir(Configuration &Conf,const string &Dir,bool const &AsSectional,
- unsigned const &Depth)
+bool ReadConfigDir(Configuration &Conf,const string &Dir,
+ bool const &AsSectional, unsigned const &Depth)
{
vector<string> const List = GetListOfFilesInDir(Dir, "", true);
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 3adab8fe7..cce8a4512 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -202,44 +202,47 @@ bool FileExists(string File)
/* If an extension is given only files with this extension are included
in the returned vector, otherwise every "normal" file is included. */
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
- bool const &SortList) {
- std::vector<string> List;
- DIR *D = opendir(Dir.c_str());
- if (D == 0) {
- _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
- return List;
- }
+ bool const &SortList)
+{
+ std::vector<string> List;
+ DIR *D = opendir(Dir.c_str());
+ if (D == 0)
+ {
+ _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
+ return List;
+ }
- for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
- if (Ent->d_name[0] == '.')
- continue;
+ for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D))
+ {
+ if (Ent->d_name[0] == '.')
+ continue;
- if (Ext.empty() == false && flExtension(Ent->d_name) != Ext)
- continue;
+ if (Ext.empty() == false && flExtension(Ent->d_name) != Ext)
+ continue;
- // Skip bad file names ala run-parts
- const char *C = Ent->d_name;
- for (; *C != 0; ++C)
- if (isalpha(*C) == 0 && isdigit(*C) == 0
- && *C != '_' && *C != '-' && *C != '.')
- break;
+ // Skip bad file names ala run-parts
+ const char *C = Ent->d_name;
+ for (; *C != 0; ++C)
+ if (isalpha(*C) == 0 && isdigit(*C) == 0
+ && *C != '_' && *C != '-' && *C != '.')
+ break;
- if (*C != 0)
- continue;
+ if (*C != 0)
+ continue;
- // Make sure it is a file and not something else
- string const File = flCombine(Dir,Ent->d_name);
- struct stat St;
- if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
- continue;
+ // Make sure it is a file and not something else
+ string const File = flCombine(Dir,Ent->d_name);
+ struct stat St;
+ if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
+ continue;
- List.push_back(File);
- }
- closedir(D);
+ List.push_back(File);
+ }
+ closedir(D);
- if (SortList == true)
- std::sort(List.begin(),List.end());
- return List;
+ if (SortList == true)
+ std::sort(List.begin(),List.end());
+ return List;
}
/*}}}*/
// SafeGetCWD - This is a safer getcwd that returns a dynamic string /*{{{*/
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 3cbf67fbb..2807c29d9 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -83,7 +83,7 @@ bool CopyFile(FileFd &From,FileFd &To);
int GetLock(string File,bool Errors = true);
bool FileExists(string File);
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
- bool const &SortList);
+ bool const &SortList);
string SafeGetCWD();
void SetCloseExec(int Fd,bool Close);
void SetNonBlock(int Fd,bool Block);