]> git.saurik.com Git - apt.git/blob - test/conf.cc
Fixed the resetting of Dir with "dir {};". Closes: #87323
[apt.git] / test / conf.cc
1 #include <apt-pkg/configuration.h>
2 #include <apt-pkg/error.h>
3
4 int 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 }