diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-10-24 22:43:37 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-11-04 18:04:03 +0100 |
commit | e7e10e47476606e3b2274cf66b1e8ea74b236757 (patch) | |
tree | 3daed3cc14405879034c562993a7b5399992f2e3 /cmdline/apt-internal-solver.cc | |
parent | cbbee23e7768750ca1c8b49bdfbf8a650131bbb6 (diff) |
deduplicate main methods
All mains pretty much do the same thing, so lets try a little harder to
move the common parts into -private to have the real differences more
visible.
Git-Dch: Ignore
Diffstat (limited to 'cmdline/apt-internal-solver.cc')
-rw-r--r-- | cmdline/apt-internal-solver.cc | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index fbcbf07e9..278f6d471 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -27,6 +27,7 @@ #include <apt-private/private-output.h> #include <apt-private/private-cmndline.h> +#include <apt-private/private-main.h> #include <string.h> #include <iostream> @@ -68,20 +69,13 @@ APT_NORETURN static void DIE(std::string const &message) { /*{{{*/ /*}}}*/ 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) { @@ -188,11 +182,6 @@ int main(int argc,const char *argv[]) /*{{{*/ 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); } /*}}}*/ |