]>
git.saurik.com Git - apt.git/blob - test/conf.cc
1 #include <apt-pkg/configuration.h>
2 #include <apt-pkg/error.h>
4 int main(int argc
,const char *argv
[])
8 ReadConfigFile(Cnf
,argv
[1],true);
10 // Process 'simple-key' type sections
11 const Configuration::Item
*Top
= Cnf
.Tree("simple-key");
12 for (Top
= (Top
== 0?0:Top
->Child
); Top
!= 0; Top
= Top
->Next
)
14 Configuration
Block(Top
);
16 string VendorID
= Top
->Tag
;
17 string FingerPrint
= Block
.Find("Fingerprint");
18 string Name
= Block
.Find("Name"); // Description?
20 if (FingerPrint
.empty() == true || Name
.empty() == true)
21 _error
->Error("Block %s is invalid",VendorID
.c_str());
23 cout
<< VendorID
<< ' ' << FingerPrint
<< ' ' << Name
<< endl
;
26 // Print any errors or warnings found during parsing
27 if (_error
->empty() == false)
29 bool Errors
= _error
->PendingError();
31 return Errors
== true?100:0;