}
/*}}}*/
// CommandLine::DispatchArg - Do something with the first arg /*{{{*/
-bool CommandLine::DispatchArg(DispatchWithHelp *Map,bool NoMatch)
+bool CommandLine::DispatchArg(DispatchWithHelp const * const Map,bool NoMatch)
{
int I;
for (I = 0; Map[I].Match != 0; I++)
void ShowHelp();
unsigned int FileSize() const APT_PURE;
bool DispatchArg(Dispatch *List,bool NoMatch = true);
- bool DispatchArg(DispatchWithHelp *List,bool NoMatch = true);
+ bool DispatchArg(DispatchWithHelp const * const List,bool NoMatch = true);
static char const * GetCommand(Dispatch const * const Map,
unsigned int const argc, char const * const * const argv) APT_PURE;
else
return false;
+ return true;
+}
+ /*}}}*/
+static bool addArgumentsAPTExtractTemplates(std::vector<CommandLine::Args> &Args, char const * const)/*{{{*/
+{
+ addArg('t',"tempdir","APT::ExtractTemplates::TempDir",CommandLine::HasArg);
+ return true;
+}
+ /*}}}*/
+static bool addArgumentsAPTFTPArchive(std::vector<CommandLine::Args> &Args, char const * const)/*{{{*/
+{
+ addArg(0,"md5","APT::FTPArchive::MD5",0);
+ addArg(0,"sha1","APT::FTPArchive::SHA1",0);
+ addArg(0,"sha256","APT::FTPArchive::SHA256",0);
+ addArg(0,"sha512","APT::FTPArchive::SHA512",0);
+ addArg('d',"db","APT::FTPArchive::DB",CommandLine::HasArg);
+ addArg('s',"source-override","APT::FTPArchive::SourceOverride",CommandLine::HasArg);
+ addArg(0,"delink","APT::FTPArchive::DeLinkAct",0);
+ addArg(0,"readonly","APT::FTPArchive::ReadOnlyDB",0);
+ addArg(0,"contents","APT::FTPArchive::Contents",0);
+ addArg('a',"arch","APT::FTPArchive::Architecture",CommandLine::HasArg);
+ return true;
+}
+ /*}}}*/
+static bool addArgumentsAPTInternalSolver(std::vector<CommandLine::Args> &, char const * const)/*{{{*/
+{
return true;
}
/*}}}*/
addArg('s',"no-act","APT::Mark::Simulate",0);
}
+ return true;
+}
+ /*}}}*/
+static bool addArgumentsAPTSortPkgs(std::vector<CommandLine::Args> &Args, char const * const)/*{{{*/
+{
+ addArg('s',"source","APT::SortPkgs::Source",0);
return true;
}
/*}}}*/
addArgumentsAPTCDROM(Args, Cmd);
else if (strcmp(Program, "apt-config") == 0)
addArgumentsAPTConfig(Args, Cmd);
+ else if (strcmp(Program, "apt-extracttemplates") == 0)
+ addArgumentsAPTExtractTemplates(Args, Cmd);
+ else if (strcmp(Program, "apt-ftparchive") == 0)
+ addArgumentsAPTFTPArchive(Args, Cmd);
+ else if (strcmp(Program, "apt-internal-solver") == 0)
+ addArgumentsAPTInternalSolver(Args, Cmd);
else if (strcmp(Program, "apt-mark") == 0)
addArgumentsAPTMark(Args, Cmd);
+ else if (strcmp(Program, "apt-sortpkg") == 0)
+ addArgumentsAPTSortPkgs(Args, Cmd);
else if (strcmp(Program, "apt") == 0)
addArgumentsAPT(Args, Cmd);
_config->MoveSubTree(conf.c_str(), NULL);
}
/*}}}*/
-void ParseCommandLine(CommandLine &CmdL, CommandLine::DispatchWithHelp const * Cmds, CommandLine::Args * const Args,/*{{{*/
+void ParseCommandLine(CommandLine &CmdL, CommandLine::DispatchWithHelp const * Cmds, char const * const Binary,/*{{{*/
Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char *argv[], bool(*ShowHelp)(CommandLine &, CommandLine::DispatchWithHelp const *))
{
- CmdL = CommandLine(Args,_config);
+ // Args running out of scope invalidates the pointer stored in CmdL,
+ // but we don't use the pointer after this function, so we ignore
+ // this problem for now and figure something out if we have to.
+ std::vector<CommandLine::Args> Args;
+ if (Cmds != nullptr && Cmds[0].Handler != nullptr)
+ Args = getCommandArgs(Binary, CommandLine::GetCommand(Cmds, argc, argv));
+ else
+ Args = getCommandArgs(Binary, Binary);
+ CmdL = CommandLine(Args.data(), _config);
+
if (Cnf != NULL && pkgInitConfig(**Cnf) == false)
{
_error->DumpErrors();
}
}
/*}}}*/
+unsigned short DispatchCommandLine(CommandLine &CmdL, CommandLine::DispatchWithHelp const * const Cmds) /*{{{*/
+{
+ // Match the operation
+ bool const returned = (Cmds != nullptr) ? CmdL.DispatchArg(Cmds) : true;
+
+ // Print any errors or warnings found during parsing
+ bool const Errors = _error->PendingError();
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors();
+ else
+ _error->DumpErrors(GlobalError::DEBUG);
+ if (returned == false)
+ return 100;
+ return Errors == true ? 100 : 0;
+}
+ /*}}}*/
class pkgSystem;
APT_PUBLIC std::vector<CommandLine::Args> getCommandArgs(char const * const Program, char const * const Cmd);
-APT_PUBLIC void ParseCommandLine(CommandLine &CmdL, CommandLine::DispatchWithHelp const * Cmds, CommandLine::Args * const Args,
+APT_PUBLIC void ParseCommandLine(CommandLine &CmdL, CommandLine::DispatchWithHelp const * Cmds, char const * const Binary,
Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char * argv[],
bool(*ShowHelp)(CommandLine &, CommandLine::DispatchWithHelp const *));
+APT_PUBLIC unsigned short DispatchCommandLine(CommandLine &CmdL, CommandLine::DispatchWithHelp const * const Cmds);
#endif
#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
#include <apt-private/private-main.h>
#include <apti18n.h>
-void InitSignals()
+void InitLocale() /*{{{*/
+{
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+}
+ /*}}}*/
+void InitSignals() /*{{{*/
{
- // Setup the signals
signal(SIGPIPE,SIG_IGN);
}
-
-
-void CheckSimulateMode(CommandLine &CmdL)
+ /*}}}*/
+void CheckIfSimulateMode(CommandLine &CmdL) /*{{{*/
{
// disable locking in simulation, but show the message only for users
// as root hasn't the same problems like unreadable files which can heavily
_config->Set("Debug::NoLocking",true);
}
}
+ /*}}}*/
+void CheckIfCalledByScript(int argc, const char *argv[]) /*{{{*/
+{
+ if (unlikely(argc < 1)) return;
+
+ if(!isatty(STDOUT_FILENO) &&
+ _config->FindB("Apt::Cmd::Disable-Script-Warning", false) == false)
+ {
+ std::cerr << std::endl
+ << "WARNING: " << flNotDir(argv[0]) << " "
+ << "does not have a stable CLI interface. "
+ << "Use with caution in scripts."
+ << std::endl
+ << std::endl;
+ }
+}
+ /*}}}*/
class CommandLine;
-APT_PUBLIC void CheckSimulateMode(CommandLine &CmdL);
+APT_PUBLIC void InitLocale();
APT_PUBLIC void InitSignals();
+APT_PUBLIC void CheckIfSimulateMode(CommandLine &CmdL);
+APT_PUBLIC void CheckIfCalledByScript(int argc, const char *argv[]);
#endif
#include <apt-private/private-cmndline.h>
#include <apt-private/private-show.h>
#include <apt-private/private-search.h>
+#include <apt-private/private-main.h>
#include <regex.h>
#include <stddef.h>
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
{"gencaches",&GenCaches, nullptr},
{"showsrc",&ShowSrcPackage, _("Show source records")},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt-cache", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
// Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-cache", &_config, &_system, argc, argv, ShowHelp);
InitOutput();
if (_config->Exists("APT::Cache::Generate") == true)
_config->Set("pkgCacheFile::Generate", _config->FindB("APT::Cache::Generate", true));
- // Match the operation
- CmdL.DispatchArg(Cmds);
-
- // Print any errors or warnings found during parsing
- bool const Errors = _error->PendingError();
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
- else
- _error->DumpErrors(GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <apt-private/private-cmndline.h>
#include <apt-private/private-output.h>
+#include <apt-private/private-main.h>
#include <apti18n.h>
/*}}}*/
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
{"add", &DoAdd, "Add a CDROM"},
{"ident", &DoIdent, "Report the identity of a CDROM"},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt-cdrom", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
// Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-cdrom", &_config, &_system, argc, argv, ShowHelp);
InitOutput();
- // Match the operation
- bool returned = CmdL.DispatchArg(Cmds);
-
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
- else
- _error->DumpErrors(GlobalError::DEBUG);
- return returned == true ? 0 : 100;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <string.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-main.h>
#include <apti18n.h>
/*}}}*/
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
{"shell", &DoShell, _("get configuration values via shell evaluation")},
{"dump", &DoDump, _("show the active configuration setting")},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt-config", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
// Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-config", &_config, &_system, argc, argv, ShowHelp);
std::vector<std::string> const langs = APT::Configuration::getLanguages(true);
_config->Clear("Acquire::Languages");
for (std::vector<std::string>::const_iterator p = profiles.begin(); p != profiles.end(); ++p)
_config->Set("APT::Build-Profiles::", *p);
- // Match the operation
- CmdL.DispatchArg(Cmds);
-
- // 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;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <apt-pkg/mmap.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-main.h>
#include <iostream>
#include <stdio.h>
/*}}}*/
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);
+ InitLocale();
// Parse the command line and initialize the package library
CommandLine::DispatchWithHelp Cmds[] = {{nullptr, nullptr, nullptr}};
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args, &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-extracttemplates", &_config, &_system, argc, argv, 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;
- }
-
- return 0;
+ return DispatchCommandLine(CmdL, nullptr);
}
/*}}}*/
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
{"update", &DoUpdate, _("Retrieve new lists of packages")},
{"upgrade", &DoUpgrade, _("Perform an upgrade")},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt-get", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
// Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-get", &_config, &_system, argc, argv, ShowHelp);
- // see if we are in simulate mode
- CheckSimulateMode(CmdL);
-
- // Init the signals
InitSignals();
-
- // Setup the output streams
InitOutput();
- // Match the operation
- CmdL.DispatchArg(Cmds);
+ CheckIfSimulateMode(CmdL);
- // Print any errors or warnings found during parsing
- bool const Errors = _error->PendingError();
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
- else
- _error->DumpErrors(GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <apt-private/private-output.h>
#include <apt-private/private-download.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-main.h>
#include <apt-pkg/srvrec.h>
#include <iostream>
int main(int argc,const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
{"download-file", &DoDownloadFile, _("download the given uri to the target-path")},
{"srv-lookup", &DoSrvLookup, _("lookup a SRV record (e.g. _http._tcp.ftp.debian.org)")},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs(
- "apt-helper", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
// Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-helper", &_config, &_system, argc, argv, ShowHelp);
InitOutput();
- // Match the operation
- CmdL.DispatchArg(Cmds);
-
- // Print any errors or warnings found during parsing
- bool const Errors = _error->PendingError();
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
- else
- _error->DumpErrors(GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <apt-private/private-output.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-main.h>
#include <string.h>
#include <iostream>
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Args Args[] = {
- {'h',"help","help",0},
- {'v',"version","version",0},
- {'q',"quiet","quiet",CommandLine::IntLevel},
- {'q',"silent","quiet",CommandLine::IntLevel},
- {'c',"config-file",0,CommandLine::ConfigFile},
- {'o',"option",0,CommandLine::ArbItem},
- {0,0,0,0}};
-
- // we really don't need anything
- DropPrivileges();
+ InitLocale();
+
+ // we really don't need anything
+ DropPrivileges();
CommandLine CmdL;
- ParseCommandLine(CmdL, nullptr, Args, &_config, NULL, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, nullptr, "apt-internal-solver", &_config, NULL, argc, argv, ShowHelp);
if (CmdL.FileList[0] != 0 && strcmp(CmdL.FileList[0], "scenario") == 0)
{
EDSP::WriteProgress(100, "Done", output);
- bool const Errors = _error->PendingError();
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors(std::cerr);
- else
- _error->DumpErrors(std::cerr, GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return DispatchCommandLine(CmdL, nullptr);
}
/*}}}*/
#include <apt-private/private-cmndline.h>
#include <apt-private/private-output.h>
+#include <apt-private/private-main.h>
#include <errno.h>
#include <fcntl.h>
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
{"auto",&DoAuto, _("Mark the given packages as automatically installed")},
{"manual",&DoAuto, _("Mark the given packages as manually installed")},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt-mark", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-mark", &_config, &_system, argc, argv, ShowHelp);
InitOutput();
- // Match the operation
- CmdL.DispatchArg(Cmds);
-
- // Print any errors or warnings found during parsing
- bool const Errors = _error->PendingError();
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
- else
- _error->DumpErrors(GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <apt-pkg/pkgsystem.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-main.h>
#include <vector>
#include <algorithm>
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
- CommandLine::Args Args[] = {
- {'h',"help","help",0},
- {'v',"version","version",0},
- {'s',"source","APT::SortPkgs::Source",0},
- {'c',"config-file",0,CommandLine::ConfigFile},
- {'o',"option",0,CommandLine::ArbItem},
- {0,0,0,0}};
-
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
+ InitLocale();
// Parse the command line and initialize the package library
CommandLine::DispatchWithHelp Cmds[] = {{nullptr, nullptr, nullptr}};
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args, &_config, &_system, argc, argv, ShowHelp);
+ ParseCommandLine(CmdL, Cmds, "apt-sortpkgs", &_config, &_system, argc, argv, ShowHelp);
// Match the operation
for (unsigned int I = 0; I != CmdL.FileSize(); I++)
if (DoIt(CmdL.FileList[I]) == false)
break;
-
- // 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;
+
+ return DispatchCommandLine(CmdL, nullptr);
}
/*}}}*/
int main(int argc, const char *argv[]) /*{{{*/
{
+ InitLocale();
+
CommandLine::DispatchWithHelp Cmds[] = {
// query
{"list", &DoList, _("list packages based on package names")},
{nullptr, nullptr, nullptr}
};
- std::vector<CommandLine::Args> Args = getCommandArgs("apt", CommandLine::GetCommand(Cmds, argc, argv));
-
- // Init the signals
+ // FIXME: Those ignore commandline configuration like -q
InitSignals();
-
- // Init the output
InitOutput();
- // Set up gettext support
- setlocale(LC_ALL,"");
- textdomain(PACKAGE);
-
- if(pkgInitConfig(*_config) == false)
- {
- _error->DumpErrors();
- return 100;
- }
-
- // Parse the command line and initialize the package library
CommandLine CmdL;
- ParseCommandLine(CmdL, Cmds, Args.data(), NULL, &_system, argc, argv, ShowHelp);
-
- if(!isatty(STDOUT_FILENO) &&
- _config->FindB("Apt::Cmd::Disable-Script-Warning", false) == false)
- {
- std::cerr << std::endl
- << "WARNING: " << argv[0] << " "
- << "does not have a stable CLI interface yet. "
- << "Use with caution in scripts."
- << std::endl
- << std::endl;
- }
-
- // see if we are in simulate mode
- CheckSimulateMode(CmdL);
+ ParseCommandLine(CmdL, Cmds, "apt", &_config, &_system, argc, argv, ShowHelp);
- // parse args
- CmdL.DispatchArg(Cmds);
+ CheckIfCalledByScript(argc, argv);
+ CheckIfSimulateMode(CmdL);
- // Print any errors or warnings found during parsing
- bool const Errors = _error->PendingError();
- if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
- else
- _error->DumpErrors(GlobalError::DEBUG);
- return Errors == true ? 100 : 0;
+ return DispatchCommandLine(CmdL, Cmds);
}
/*}}}*/
#include <apt-private/private-cmndline.h>
#include <apt-private/private-output.h>
+#include <apt-private/private-main.h>
#include <algorithm>
#include <climits>
int main(int argc, const char *argv[])
{
- setlocale(LC_ALL, "");
- CommandLine::Args Args[] = {
- {'h',"help","help",0},
- {0,"md5","APT::FTPArchive::MD5",0},
- {0,"sha1","APT::FTPArchive::SHA1",0},
- {0,"sha256","APT::FTPArchive::SHA256",0},
- {0,"sha512","APT::FTPArchive::SHA512",0},
- {'v',"version","version",0},
- {'d',"db","APT::FTPArchive::DB",CommandLine::HasArg},
- {'s',"source-override","APT::FTPArchive::SourceOverride",CommandLine::HasArg},
- {'q',"quiet","quiet",CommandLine::IntLevel},
- {'q',"silent","quiet",CommandLine::IntLevel},
- {0,"delink","APT::FTPArchive::DeLinkAct",0},
- {0,"readonly","APT::FTPArchive::ReadOnlyDB",0},
- {0,"contents","APT::FTPArchive::Contents",0},
- {'a',"arch","APT::FTPArchive::Architecture",CommandLine::HasArg},
- {'c',"config-file",0,CommandLine::ConfigFile},
- {'o',"option",0,CommandLine::ArbItem},
- {0,0,0,0}};
+ InitLocale();
CommandLine::DispatchWithHelp Cmds[] = {
{"packages",&SimpleGenPackages, nullptr},
};
// Parse the command line and initialize the package library
- CommandLine CmdL(Args,_config);
- ParseCommandLine(CmdL, Cmds, Args, &_config, NULL, argc, argv, ShowHelp);
+ CommandLine CmdL;
+ ParseCommandLine(CmdL, Cmds, "apt-ftparchive", &_config, NULL, argc, argv, ShowHelp);
_config->CndSet("quiet",0);
Quiet = _config->FindI("quiet",0);
InitOutput(clog.rdbuf());
- // Match the operation
- CmdL.DispatchArg(Cmds);
-
- if (_error->empty() == false)
- {
- bool Errors = _error->PendingError();
- _error->DumpErrors();
- return Errors == true?100:0;
- }
- return 0;
+ return DispatchCommandLine(CmdL, Cmds);
}