From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, acme@redhat.com,
jolsa@redhat.com, namhyung@kernel.org, dsahern@gmail.com,
Michael Lentine <mlentine@google.com>
Subject: [PATCH v2 1/2] perf tools: add cat as fallback pager
Date: Tue, 20 May 2014 11:48:49 +0200 [thread overview]
Message-ID: <1400579330-5043-2-git-send-email-eranian@google.com> (raw)
In-Reply-To: <1400579330-5043-1-git-send-email-eranian@google.com>
From: Michael Lentine <mlentine@google.com>
This patch adds a fallback to cat for the pager. This is useful
on environmnents, such as Android, where less does not exist.
It is better to default to cat than to abort.
Reviewed-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Michael Lentine <mlentine@google.com>
---
| 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index 3322b84..31ee02d 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 */
--
1.9.1.423.g4596e3a
next prev parent reply other threads:[~2014-05-20 9:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 9:48 [PATCH v2 0/2] perf tools: improve perf support on Android Stephane Eranian
2014-05-20 9:48 ` Stephane Eranian [this message]
2014-05-22 12:24 ` [tip:perf/core] perf tools: Add cat as fallback pager tip-bot for Michael Lentine
2014-05-20 9:48 ` [PATCH v2 2/2] perf tools: add automatic remapping of Android libraries Stephane Eranian
2014-05-22 12:24 ` [tip:perf/core] perf tools: Add " tip-bot for Michael Lentine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400579330-5043-2-git-send-email-eranian@google.com \
--to=eranian@google.com \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mlentine@google.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox