Skip to content

Commit

Permalink
perf tools: Add cat as fallback pager
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Lentine authored and Jiri Olsa committed May 21, 2014
1 parent f21d181 commit 21cfc5e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/perf/util/pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ void setup_pager(void)
}
if (!pager)
pager = getenv("PAGER");
if (!pager) {
if (!access("/usr/bin/pager", X_OK))
pager = "/usr/bin/pager";
}
if (!(pager || access("/usr/bin/pager", X_OK)))
pager = "/usr/bin/pager";
if (!(pager || access("/usr/bin/less", X_OK)))
pager = "/usr/bin/less";
if (!pager)
pager = "less";
else if (!*pager || !strcmp(pager, "cat"))
pager = "cat";
if (!*pager || !strcmp(pager, "cat"))
return;

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

0 comments on commit 21cfc5e

Please sign in to comment.