Skip to content

Commit 21cfc5e

Browse files
Michael Lentineolsajiri
authored andcommitted
perf tools: Add cat as fallback pager
This patch adds a fallback to cat for the pager. This is useful on environments, such as Android, where less does not exist. It is better to default to cat than to abort. Signed-off-by: Michael Lentine <mlentine@google.com> Reviewed-by: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1400579330-5043-2-git-send-email-eranian@google.com Signed-off-by: Jiri Olsa <jolsa@kernel.org>
1 parent f21d181 commit 21cfc5e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎tools/perf/util/pager.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ void setup_pager(void)
5757
}
5858
if (!pager)
5959
pager = getenv("PAGER");
60-
if (!pager) {
61-
if (!access("/usr/bin/pager", X_OK))
62-
pager = "/usr/bin/pager";
63-
}
60+
if (!(pager || access("/usr/bin/pager", X_OK)))
61+
pager = "/usr/bin/pager";
62+
if (!(pager || access("/usr/bin/less", X_OK)))
63+
pager = "/usr/bin/less";
6464
if (!pager)
65-
pager = "less";
66-
else if (!*pager || !strcmp(pager, "cat"))
65+
pager = "cat";
66+
if (!*pager || !strcmp(pager, "cat"))
6767
return;
6868

6969
spawned_pager = 1; /* means we are emitting to terminal */

0 commit comments

Comments
 (0)