]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/sourcelist.cc
Use std C++ header names for includes
[apt.git] / apt-pkg / sourcelist.cc
index 51289a43d1af6da05f3765c6af2145ce4b97d6d2..cb1287623f71447b0f3414254e4c3988896f76c2 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: sourcelist.cc,v 1.19 2001/03/13 06:51:46 jgg Exp $
+// $Id: sourcelist.cc,v 1.22 2002/03/26 07:38:58 jgg Exp $
 /* ######################################################################
 
    List of Sources
 
 #include <apti18n.h>
 
-#include <fstream.h>
+#include <fstream>
                                                                        /*}}}*/
 
-// Global list of Item supported
+using namespace std;
+
+// Global list of Items supported
 static  pkgSourceList::Type *ItmList[10];
 pkgSourceList::Type **pkgSourceList::Type::GlobalList = ItmList;
 unsigned long pkgSourceList::Type::GlobalListLen = 0;
@@ -169,6 +171,31 @@ bool pkgSourceList::ReadVendors()
       VendorList.push_back(Vendor);
    }
 
+   /* XXX Process 'group-key' type sections
+      This is currently faked out so that the vendors file format is
+      parsed but nothing is done with it except check for validity */
+   Top = Cnf.Tree("group-key");
+   for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
+   {
+      Configuration Block(Top);
+      Vendor *Vendor;
+      
+      Vendor = new pkgSourceList::Vendor;
+      
+      Vendor->VendorID = Top->Tag;
+      Vendor->Description = Block.Find("Name");
+
+      if (Vendor->Description.empty() == true)
+      {
+         _error->Error(_("Vendor block %s is invalid"), 
+                      Vendor->VendorID.c_str());
+        delete Vendor;
+        continue;
+      }
+      
+      VendorList.push_back(Vendor);
+   }
+   
    return !_error->PendingError();
 }
                                                                        /*}}}*/
@@ -186,7 +213,7 @@ bool pkgSourceList::ReadMainList()
 bool pkgSourceList::Read(string File)
 {
    // Open the stream for reading
-   ifstream F(File.c_str(),ios::in | ios::nocreate);
+   ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
    if (!F != 0)
       return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());