+int main(int argc, const char **argv)
+{
+ CommandLine::Args Args[] = {
+ {'h',"help","help",0},
+ {'v',"version","version",0},
+ {'t',"tempdir","APT::ExtractTemplates::TempDir",CommandLine::HasArg},
+ {'c',"config-file",0,CommandLine::ConfigFile},
+ {'o',"option",0,CommandLine::ArbItem},
+ {0,0,0,0}};
+
+ // Set up gettext support
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+
+ // Parse the command line and initialize the package library
+ CommandLine CmdL(Args,_config);
+ if (pkgInitConfig(*_config) == false ||
+ CmdL.Parse(argc,argv) == false ||
+ pkgInitSystem(*_config,_system) == false)
+ {
+ _error->DumpErrors();
+ return 100;
+ }
+
+ // See if the help should be shown
+ if (_config->FindB("help") == true ||
+ CmdL.FileSize() == 0)
+ return ShowHelp();
+
+ Go(CmdL);
+
+ // Print any errors or warnings found during operation
+ if (_error->empty() == false)
+ {
+ // This goes to stderr..
+ bool Errors = _error->PendingError();
+ _error->DumpErrors();
+ return Errors == true?100:0;
+ }
+