diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:56:32 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:56:32 +0000 |
commit | b2e465d6d32d2dc884f58b94acb7e35f671a87fe (patch) | |
tree | 5928383b9bde7b0ba9812e6526ad746466e558f7 /test/conf.cc | |
parent | 00b47c98ca4a4349686a082eba6d77decbb03a4d (diff) |
Join with aliencode
Author: jgg
Date: 2001-02-20 07:03:16 GMT
Join with aliencode
Diffstat (limited to 'test/conf.cc')
-rw-r--r-- | test/conf.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/conf.cc b/test/conf.cc new file mode 100644 index 000000000..c44161426 --- /dev/null +++ b/test/conf.cc @@ -0,0 +1,35 @@ +#include <apt-pkg/configuration.h> +#include <apt-pkg/error.h> + +int main(int argc,const char *argv[]) +{ + Configuration Cnf; + + ReadConfigFile(Cnf,argv[1],true); + + // Process 'simple-key' type sections + const Configuration::Item *Top = Cnf.Tree("simple-key"); + for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next) + { + Configuration Block(Top); + + string VendorID = Top->Tag; + string FingerPrint = Block.Find("Fingerprint"); + string Name = Block.Find("Name"); // Description? + + if (FingerPrint.empty() == true || Name.empty() == true) + _error->Error("Block %s is invalid",VendorID.c_str()); + + cout << VendorID << ' ' << FingerPrint << ' ' << Name << endl; + } + + // Print any errors or warnings found during parsing + if (_error->empty() == false) + { + bool Errors = _error->PendingError(); + _error->DumpErrors(); + return Errors == true?100:0; + } + + return 0; +} |