X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/4fc6b7570c3e97b65c118b58cdf6729fa94c9b03..21248c0f00ee71412dbadc6ebf84011cf974346d:/cmdline/apt-helper.cc diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index a97fc903f..482e64dd1 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,29 @@ static bool DoDownloadFile(CommandLine &CmdL) return true; } +static bool DoSrvLookup(CommandLine &CmdL) +{ + if (CmdL.FileSize() < 1) + return _error->Error(_("Must specifc at least one srv record")); + + std::vector srv_records; + for(int i=1; CmdL.FileList[i] != NULL; i++) + { + if(GetSrvRecords(CmdL.FileList[i], srv_records) == false) + _error->Warning(_("GetSrvRec failed for %s"), CmdL.FileList[i]); + for (std::vector::const_iterator I = srv_records.begin(); + I != srv_records.end(); ++I) + { + c1out << (*I).target.c_str() << " " + << (*I).priority << " " + << (*I).weight << " " + << (*I).port << " " + << std::endl; + } + } + return true; +} + static bool ShowHelp(CommandLine &) { ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH); @@ -107,6 +131,7 @@ int main(int argc,const char *argv[]) /*{{{*/ { CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp}, {"download-file", &DoDownloadFile}, + {"srv-lookup", &DoSrvLookup}, {"auto-detect-proxy", &DoAutoDetectProxy}, {0,0}};