]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-cmndline.cc
Move sysconf(_SC_OPEN_MAX); out of the for() loop to avoid unneeded syscalls
[apt.git] / apt-private / private-cmndline.cc
index 132da04d579f040c11e85613d638d3e866e55000..0b5ba5b4fdf81c07846dacdbe2c06810dc2cbffb 100644 (file)
@@ -2,19 +2,17 @@
 #include <config.h>
 
 #include <apt-pkg/cmndline.h>
-#include <apt-pkg/configuration.h>
 
-#include <vector>
+#include <apt-private/private-cmndline.h>
 
+#include <vector>
 #include <stdarg.h>
 #include <string.h>
 
-#include "private-cmndline.h"
-
 #include <apti18n.h>
                                                                        /*}}}*/
 
-static bool strcmp_match_in_list(char const * const Cmd, ...)          /*{{{*/
+APT_SENTINEL static bool strcmp_match_in_list(char const * const Cmd, ...)             /*{{{*/
 {
    va_list args;
    bool found = false;
@@ -72,6 +70,8 @@ static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char cons
    else
       return false;
 
+   bool const found_something = Args.empty() == false;
+
    // FIXME: move to the correct command(s)
    addArg('g', "generate", "APT::Cache::Generate", 0);
    addArg('t', "target-release", "APT::Default-Release", CommandLine::HasArg);
@@ -79,7 +79,8 @@ static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char cons
 
    addArg('p', "pkg-cache", "Dir::Cache::pkgcache", CommandLine::HasArg);
    addArg('s', "src-cache", "Dir::Cache::srcpkgcache", CommandLine::HasArg);
-   return true;
+
+   return found_something;
 }
                                                                        /*}}}*/
 static bool addArgumentsAPTCDROM(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
@@ -118,7 +119,7 @@ static bool addArgumentsAPTConfig(std::vector<CommandLine::Args> &Args, char con
 static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/
 {
    if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade",
-           "dselect-upgrade", "autoremove"))
+           "dselect-upgrade", "autoremove", "full-upgrade"))
    {
       addArg(0, "show-progress", "DpkgPM::Progress", 0);
       addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0);
@@ -165,7 +166,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
 
    if (CmdMatches("install", "remove", "purge", "upgrade", "dist-upgrade",
            "deselect-upgrade", "autoremove", "clean", "autoclean", "check",
-           "build-dep"))
+           "build-dep", "full-upgrade", "source"))
    {
       addArg('s', "simulate", "APT::Get::Simulate", 0);
       addArg('s', "just-print", "APT::Get::Simulate", 0);
@@ -174,6 +175,8 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
       addArg('s', "no-act", "APT::Get::Simulate", 0);
    }
 
+   bool const found_something = Args.empty() == false;
+
    // FIXME: move to the correct command(s)
    addArg('d',"download-only","APT::Get::Download-Only",0);
    addArg('y',"yes","APT::Get::Assume-Yes",0);
@@ -199,7 +202,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
    addArg(0,"install-suggests","APT::Install-Suggests",CommandLine::Boolean);
    addArg(0,"fix-policy","APT::Get::Fix-Policy-Broken",0);
 
-   return true;
+   return found_something;
 }
                                                                        /*}}}*/
 static bool addArgumentsAPTMark(std::vector<CommandLine::Args> &Args, char const * const Cmd)/*{{{*/