]> git.saurik.com Git - apt.git/blame - test/conf.cc
Doc updates
[apt.git] / test / conf.cc
CommitLineData
b2e465d6
AL
1#include <apt-pkg/configuration.h>
2#include <apt-pkg/error.h>
3
4int main(int argc,const char *argv[])
5{
6 Configuration Cnf;
7
8 ReadConfigFile(Cnf,argv[1],true);
9
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)
13 {
14 Configuration Block(Top);
15
16 string VendorID = Top->Tag;
17 string FingerPrint = Block.Find("Fingerprint");
18 string Name = Block.Find("Name"); // Description?
19
20 if (FingerPrint.empty() == true || Name.empty() == true)
21 _error->Error("Block %s is invalid",VendorID.c_str());
22
23 cout << VendorID << ' ' << FingerPrint << ' ' << Name << endl;
24 }
25
26 // Print any errors or warnings found during parsing
27 if (_error->empty() == false)
28 {
29 bool Errors = _error->PendingError();
30 _error->DumpErrors();
31 return Errors == true?100:0;
32 }
33
34 return 0;
35}