public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Michael Lentine <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, eranian@google.com, hpa@zytor.com,
	mingo@kernel.org, jolsa@kernel.org, mlentine@google.com,
	tglx@linutronix.de
Subject: [tip:perf/core] perf tools: Add cat as fallback pager
Date: Thu, 22 May 2014 05:24:27 -0700	[thread overview]
Message-ID: <tip-21cfc5e10395eba795c0610cf3cf7f0a4f6f33ff@git.kernel.org> (raw)
In-Reply-To: <1400579330-5043-2-git-send-email-eranian@google.com>

Commit-ID:  21cfc5e10395eba795c0610cf3cf7f0a4f6f33ff
Gitweb:     http://git.kernel.org/tip/21cfc5e10395eba795c0610cf3cf7f0a4f6f33ff
Author:     Michael Lentine <mlentine@google.com>
AuthorDate: Tue, 20 May 2014 11:48:49 +0200
Committer:  Jiri Olsa <jolsa@kernel.org>
CommitDate: Wed, 21 May 2014 11:48:33 +0200

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>
---
 tools/perf/util/pager.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --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 */

  reply	other threads:[~2014-05-22 12:24 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 ` [PATCH v2 1/2] perf tools: add cat as fallback pager Stephane Eranian
2014-05-22 12:24   ` tip-bot for Michael Lentine [this message]
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=tip-21cfc5e10395eba795c0610cf3cf7f0a4f6f33ff@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mlentine@google.com \
    --cc=tglx@linutronix.de \
    /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