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