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