diff options
author | Guillem Jover <guillem@debian.org> | 2018-10-01 02:49:20 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2018-10-08 12:11:52 +0200 |
commit | 68b0f4dd8ac3f541926796a303015df782ef76ed (patch) | |
tree | 6ff7f209338b70a2ec14fee37a8fc7cce637440e /lib | |
parent | 473cbd6a163eb685ec1fbd5301224c2964d7efb4 (diff) | |
download | dpkg-68b0f4dd8ac3f541926796a303015df782ef76ed.tar.gz |
libdpkg: Add a pager kill switch
This way we will be able to forcefully disable it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpkg/pager.c | 11 | ||||
-rw-r--r-- | lib/dpkg/pager.h | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/dpkg/pager.c b/lib/dpkg/pager.c index b2dad68b4..b0e54101e 100644 --- a/lib/dpkg/pager.c +++ b/lib/dpkg/pager.c @@ -35,6 +35,14 @@ #include <dpkg/command.h> #include <dpkg/pager.h> +static bool pager_enabled = true; + +void +pager_enable(bool enable) +{ + pager_enabled = enable; +} + /** * Get a suitable pager. * @@ -81,6 +89,9 @@ pager_spawn(const char *desc) if (strcmp(exec, CAT) == 0) pager->used = false; + if (!pager_enabled) + pager->used = false; + if (!pager->used) return pager; diff --git a/lib/dpkg/pager.h b/lib/dpkg/pager.h index 34bcf2fd5..f9029d0a5 100644 --- a/lib/dpkg/pager.h +++ b/lib/dpkg/pager.h @@ -21,6 +21,8 @@ #ifndef LIBDPKG_PAGER_H #define LIBDPKG_PAGER_H +#include <stdbool.h> + #include <dpkg/macros.h> DPKG_BEGIN_DECLS @@ -33,6 +35,9 @@ DPKG_BEGIN_DECLS struct pager; +void +pager_enable(bool enable); + const char * pager_get_exec(void); |