You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
986 B

  1. #include <apt-pkg/configuration.h>
  2. #include <apt-pkg/error.h>
  3. using namespace std;
  4. int main(int argc,const char *argv[])
  5. {
  6. Configuration Cnf;
  7. ReadConfigFile(Cnf,argv[1],true);
  8. // Process 'simple-key' type sections
  9. const Configuration::Item *Top = Cnf.Tree("simple-key");
  10. for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
  11. {
  12. Configuration Block(Top);
  13. string VendorID = Top->Tag;
  14. string FingerPrint = Block.Find("Fingerprint");
  15. string Name = Block.Find("Name"); // Description?
  16. if (FingerPrint.empty() == true || Name.empty() == true)
  17. _error->Error("Block %s is invalid",VendorID.c_str());
  18. cout << VendorID << ' ' << FingerPrint << ' ' << Name << endl;
  19. }
  20. // Print any errors or warnings found during parsing
  21. if (_error->empty() == false)
  22. {
  23. bool Errors = _error->PendingError();
  24. _error->DumpErrors();
  25. return Errors == true?100:0;
  26. }
  27. return 0;
  28. }