This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=68b0f4dd8ac3f541926796a303015df782ef76ed

commit 68b0f4dd8ac3f541926796a303015df782ef76ed
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Oct 1 02:49:20 2018 +0200

    libdpkg: Add a pager kill switch
    
    This way we will be able to forcefully disable it.
---
 debian/changelog |  1 +
 lib/dpkg/pager.c | 11 +++++++++++
 lib/dpkg/pager.h |  5 +++++
 3 files changed, 17 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 616491dfb..6a958a519 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,7 @@ dpkg (1.19.2) UNRELEASED; urgency=medium
     - dpkg-split: Use nfstrnsave() instead of nfmalloc() + memcpy().
     - libdpkg: Add new fsys-dir module.
     - libdpkg: Pass the file contents to the pager instead of the filename.
+    - libdpkg: Add a pager kill switch, so that it can be forcefully disabled.
   * Build system:
     - Distribute a LICENSE file on CPAN.
     - Do not make the Build.PL script executable.
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);
 

-- 
Dpkg.Org's dpkg

Reply via email to