On Thu, May 10, 2012 at 12:30:52PM -0000, Avik Sil wrote: > Does this patch look OK? > > diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c > index 1915de2..d6f23de 100644 > --- a/tools/perf/util/pager.c > +++ b/tools/perf/util/pager.c > @@ -57,8 +57,12 @@ void setup_pager(void) > } > if (!pager) > pager = getenv("PAGER"); > - if (!pager) > - pager = "less"; > + if (!pager) { > + if (!access("/usr/bin/pager", X_OK)) > + pager = "/usr/bin/pager"; > + else > + pager = "less";
To conform to the existing code style, you might want to write the code as follows:
+ if (!pager) { + if (!access("/usr/bin/pager", X_OK)) + pager = "/usr/bin/pager"; + } + if (!pager) + pager = "less";
Functionally, the code looks OK to me either way.
Cheers ---Dave
On Thu, May 10, 2012 at 12:30:52PM -0000, Avik Sil wrote: perf/util/ pager.c b/tools/ perf/util/ pager.c perf/util/ pager.c perf/util/ pager.c "/usr/bin/ pager", X_OK))
> Does this patch look OK?
>
> diff --git a/tools/
> index 1915de2..d6f23de 100644
> --- a/tools/
> +++ b/tools/
> @@ -57,8 +57,12 @@ void setup_pager(void)
> }
> if (!pager)
> pager = getenv("PAGER");
> - if (!pager)
> - pager = "less";
> + if (!pager) {
> + if (!access(
> + pager = "/usr/bin/pager";
> + else
> + pager = "less";
To conform to the existing code style, you might want to write the code
as follows:
+ if (!pager) { "/usr/bin/ pager", X_OK))
+ if (!access(
+ pager = "/usr/bin/pager";
+ }
+ if (!pager)
+ pager = "less";
Functionally, the code looks OK to me either way.
Cheers
---Dave