diff options
Diffstat (limited to 'apt-pkg/sourcelist.cc')
-rw-r--r-- | apt-pkg/sourcelist.cc | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 6b7a299d6..a860c7eac 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -17,13 +17,6 @@ #include <apti18n.h> #include <fstream> - -// CNC:2003-03-03 - This is needed for ReadDir stuff. -#include <algorithm> -#include <stdio.h> -#include <dirent.h> -#include <sys/stat.h> -#include <unistd.h> /*}}}*/ using namespace std; @@ -331,41 +324,7 @@ bool pkgSourceList::GetIndexes(pkgAcquire *Owner, bool GetAll) const /* */ bool pkgSourceList::ReadSourceDir(string Dir) { - DIR *D = opendir(Dir.c_str()); - if (D == 0) - return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); - - vector<string> List; - - for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) - { - if (Ent->d_name[0] == '.') - continue; - - // CNC:2003-12-02 Only accept .list files as valid sourceparts - if (flExtension(Ent->d_name) != "list") - 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; - if (*C != 0) - continue; - - // Make sure it is a file and not something else - string 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); - - sort(List.begin(),List.end()); + vector<string> const List = GetListOfFilesInDir(Dir, "list", true); // Read the files for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++) |