summaryrefslogtreecommitdiff
path: root/src/shared/pager.c
diff options
context:
space:
mode:
authorAlexander Kuleshov <kuleshovmail@gmail.com>2016-02-20 00:25:13 +0600
committerAlexander Kuleshov <kuleshovmail@gmail.com>2016-02-26 01:13:23 +0600
commitea4b98e6577ad4311e4eb4d2384c82f0d870b5ba (patch)
tree74820b01e48c222774c3884adc1ae73d39acb49e /src/shared/pager.c
parent16fe5e8b1d5b073c5731b170c34bddd52ccbc4ec (diff)
tree-wide: merge pager_open_if_enabled() to the pager_open()
Many subsystems define own pager_open_if_enabled() function which checks '--no-pager' command line argument and open pager depends on its value. All implementations of pager_open_if_enabled() are the same. Let's merger this function with pager_open() from the shared/pager.c and remove pager_open_if_enabled() from all subsytems to prevent code duplication.
Diffstat (limited to 'src/shared/pager.c')
-rw-r--r--src/shared/pager.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 05b2b15e40..c16bc027be 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -52,11 +52,14 @@ noreturn static void pager_fallback(void) {
_exit(EXIT_SUCCESS);
}
-int pager_open(bool jump_to_end) {
+int pager_open(bool no_pager, bool jump_to_end) {
_cleanup_close_pair_ int fd[2] = { -1, -1 };
const char *pager;
pid_t parent_pid;
+ if (no_pager)
+ return 0;
+
if (pager_pid > 0)
return 1;