Commit 21cfc5e1 authored by Michael Lentine's avatar Michael Lentine Committed by Jiri Olsa

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: default avatarMichael Lentine <mlentine@google.com>
Reviewed-by: default avatarStephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1400579330-5043-2-git-send-email-eranian@google.comSigned-off-by: default avatarJiri Olsa <jolsa@kernel.org>
parent f21d1815
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment