summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc4
-rw-r--r--cmdline/apt-cdrom.cc7
-rw-r--r--cmdline/apt-mark.cc18
3 files changed, 6 insertions, 23 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 12ed4f719..342ad1858 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1899,9 +1899,7 @@ int main(int argc,const char *argv[]) /*{{{*/
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
- // Deal with stdout not being a tty
- if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
- _config->Set("quiet","1");
+ InitOutput();
if (_config->Exists("APT::Cache::Generate") == true)
_config->Set("pkgCacheFile::Generate", _config->FindB("APT::Cache::Generate", true));
diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc
index 8ac73fd7e..327039e00 100644
--- a/cmdline/apt-cdrom.cc
+++ b/cmdline/apt-cdrom.cc
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-output.h>
#include <apti18n.h>
/*}}}*/
@@ -252,10 +253,8 @@ int main(int argc,const char *argv[]) /*{{{*/
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
- // Deal with stdout not being a tty
- if (isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
- _config->Set("quiet","1");
-
+ InitOutput();
+
// Match the operation
bool returned = CmdL.DispatchArg(Cmds);
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index 487f3d8a1..2702dbbd3 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -22,6 +22,7 @@
#include <apt-pkg/pkgcache.h>
#include <apt-private/private-cmndline.h>
+#include <apt-private/private-output.h>
#include <errno.h>
#include <fcntl.h>
@@ -41,10 +42,6 @@
/*}}}*/
using namespace std;
-ostream c0out(0);
-ostream c1out(0);
-ostream c2out(0);
-ofstream devnull("/dev/null");
/* DoAuto - mark packages as automatically/manually installed {{{*/
static bool DoAuto(CommandLine &CmdL)
{
@@ -444,18 +441,7 @@ int main(int argc,const char *argv[]) /*{{{*/
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
- // Deal with stdout not being a tty
- if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
- _config->Set("quiet","1");
-
- // Setup the output streams
- c0out.rdbuf(cout.rdbuf());
- c1out.rdbuf(cout.rdbuf());
- c2out.rdbuf(cout.rdbuf());
- if (_config->FindI("quiet",0) > 0)
- c0out.rdbuf(devnull.rdbuf());
- if (_config->FindI("quiet",0) > 1)
- c1out.rdbuf(devnull.rdbuf());
+ InitOutput();
// Match the operation
CmdL.DispatchArg(Cmds);