summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2014-05-20 13:48:49 +0400
committerJiri Olsa <jolsa@kernel.org>2014-05-21 13:48:33 +0400
commit21cfc5e10395eba795c0610cf3cf7f0a4f6f33ff (patch)
treeb30e4aa479daa730ded93a209bc54fbe627fe37d /tools/perf
parentf21d1815295ee79ce0767cb08d6f3ffa3a3b5cfe (diff)
downloadlinux-21cfc5e10395eba795c0610cf3cf7f0a4f6f33ff.tar.xz
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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/pager.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index 3322b8446e89..31ee02d4e988 100644
--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -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 */