summaryrefslogtreecommitdiff
path: root/src/journal
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/journal
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/journal')
-rw-r--r--src/journal/journalctl.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 273242bea6..c111b1f0e1 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -225,14 +225,6 @@ static int add_matches_for_device(sd_journal *j, const char *devpath) {
return 0;
}
-static void pager_open_if_enabled(void) {
-
- if (arg_no_pager)
- return;
-
- pager_open(arg_pager_end);
-}
-
static char *format_timestamp_maybe_utc(char *buf, size_t l, usec_t t) {
if (arg_utc)
@@ -278,7 +270,7 @@ static int parse_boot_descriptor(const char *x, sd_id128_t *boot_id, int *offset
static void help(void) {
- pager_open_if_enabled();
+ pager_open(arg_no_pager, arg_pager_end);
printf("%s [OPTIONS...] [MATCHES...]\n\n"
"Query the journal.\n\n"
@@ -1183,7 +1175,7 @@ static int list_boots(sd_journal *j) {
if (count == 0)
return count;
- pager_open_if_enabled();
+ pager_open(arg_no_pager, arg_pager_end);
/* numbers are one less, but we need an extra char for the sign */
w = DECIMAL_STR_WIDTH(count - 1) + 1;
@@ -2061,7 +2053,7 @@ int main(int argc, char *argv[]) {
} else {
bool oneline = arg_action == ACTION_LIST_CATALOG;
- pager_open_if_enabled();
+ pager_open(arg_no_pager, arg_pager_end);
if (optind < argc)
r = catalog_list_items(stdout, database, oneline, argv + optind);
@@ -2368,7 +2360,7 @@ int main(int argc, char *argv[]) {
}
if (!arg_follow)
- pager_open_if_enabled();
+ pager_open(arg_no_pager, arg_pager_end);
if (!arg_quiet) {
usec_t start, end;