}
}
/*}}}*/
-static bool ShowCommonHelp(APT_CMD const Binary, CommandLine &CmdL, std::vector<aptDispatchWithHelp> const &Cmds)/*{{{*/
+static bool ShowCommonHelp(APT_CMD const Binary, CommandLine &CmdL, std::vector<aptDispatchWithHelp> const &Cmds,/*{{{*/
+ bool (*ShowHelp)(CommandLine &))
{
std::cout << PACKAGE << " " << PACKAGE_VERSION << " (" << COMMON_ARCH << ")" << std::endl;
if (_config->FindB("version") == true && Binary != APT_CMD::APT_GET)
}
/*}}}*/
std::vector<CommandLine::Dispatch> ParseCommandLine(CommandLine &CmdL, APT_CMD const Binary,/*{{{*/
- Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char *argv[])
+ Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char *argv[],
+ bool (*ShowHelp)(CommandLine &), std::vector<aptDispatchWithHelp> (*GetCommands)(void))
{
if (Cnf != NULL && pkgInitConfig(**Cnf) == false)
{
(Sys != NULL && pkgInitSystem(*_config, *Sys) == false))
{
if (_config->FindB("version") == true)
- ShowCommonHelp(Binary, CmdL, CmdsWithHelp);
+ ShowCommonHelp(Binary, CmdL, CmdsWithHelp, ShowHelp);
_error->DumpErrors();
exit(100);
if (_config->FindB("help") == true || _config->FindB("version") == true ||
(CmdL.FileSize() > 0 && strcmp(CmdL.FileList[0], "help") == 0))
{
- ShowCommonHelp(Binary, CmdL, CmdsWithHelp);
+ ShowCommonHelp(Binary, CmdL, CmdsWithHelp, ShowHelp);
exit(0);
}
if (Cmds.empty() == false && CmdL.FileSize() == 0)
{
- ShowCommonHelp(Binary, CmdL, CmdsWithHelp);
+ ShowCommonHelp(Binary, CmdL, CmdsWithHelp, ShowHelp);
exit(1);
}
return Cmds;
return Errors == true ? 100 : 0;
}
/*}}}*/
-
-// weak symbols
-bool ShowHelp(CommandLine &) { return false; }
-std::vector<aptDispatchWithHelp> GetCommands() { return {}; }
APT_PUBLIC std::vector<aptDispatchWithHelp> GetCommands() APT_WEAK;
APT_PUBLIC std::vector<CommandLine::Dispatch> ParseCommandLine(CommandLine &CmdL, APT_CMD const Binary,
- Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char * argv[]);
+ Configuration * const * const Cnf, pkgSystem ** const Sys, int const argc, const char * argv[],
+ bool (*ShowHelp)(CommandLine &), std::vector<aptDispatchWithHelp> (*GetCommands)(void));
APT_PUBLIC unsigned short DispatchCommandLine(CommandLine &CmdL, std::vector<CommandLine::Dispatch> const &Cmds);
APT_PUBLIC std::vector<CommandLine::Args> getCommandArgs(APT_CMD const Program, char const * const Cmd);
// Parse the command line and initialize the package library
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CACHE, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CACHE, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
InitOutput();
// Parse the command line and initialize the package library
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CDROM, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CDROM, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
InitOutput();
// Parse the command line and initialize the package library
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CONFIG, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_CONFIG, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
std::vector<std::string> const langs = APT::Configuration::getLanguages(true);
_config->Clear("Acquire::Languages");
InitLocale();
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
Go(CmdL);
// Parse the command line and initialize the package library
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_GET, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_GET, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
InitSignals();
InitOutput();
InitLocale();
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_HELPER, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_HELPER, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
InitOutput();
DropPrivileges();
CommandLine CmdL;
- ParseCommandLine(CmdL, APT_CMD::APT_INTERNAL_SOLVER, &_config, NULL, argc, argv);
+ ParseCommandLine(CmdL, APT_CMD::APT_INTERNAL_SOLVER, &_config, NULL, argc, argv, &ShowHelp, &GetCommands);
if (CmdL.FileList[0] != 0 && strcmp(CmdL.FileList[0], "scenario") == 0)
{
InitLocale();
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_MARK, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_MARK, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
InitOutput();
InitLocale();
CommandLine CmdL;
- ParseCommandLine(CmdL, APT_CMD::APT_SORTPKG, &_config, &_system, argc, argv);
+ ParseCommandLine(CmdL, APT_CMD::APT_SORTPKG, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
// Match the operation
for (unsigned int I = 0; I != CmdL.FileSize(); I++)
InitLocale();
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
int const quiet = _config->FindI("quiet", 0);
if (quiet == 2)
# (http://savannah.gnu.org/bugs/?10593)
dpkg_buildflags = DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags
export CXXFLAGS = $(shell $(dpkg_buildflags) --get CXXFLAGS)
- # we can not use "-Wl,-Bsymbolic-functions" with the new weak symbols
- # in libapt-private (commit 28f24d3d added those)
- comma:= ,
- export LDFLAGS = $(subst -Wl$(comma)-Bsymbolic-functions,,$(shell $(dpkg_buildflags) --get LDFLAGS))
+ export LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS)
export CPPFLAGS = $(shell $(dpkg_buildflags) --get CPPFLAGS)
else
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
// Parse the command line and initialize the package library
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_FTPARCHIVE, &_config, NULL, argc, argv);
+ auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_FTPARCHIVE, &_config, NULL, argc, argv, ShowHelp, &GetCommands);
_config->CndSet("quiet",0);
Quiet = _config->FindI("quiet",0);