[PATCH] paginate output of configure --help

View: New views
4 Messages — Rating Filter:   Alert me  

[PATCH] paginate output of configure --help

by william pursell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This may be a controversial patch, but I think that
of all the times I have ever run configure --help
without appending "|less" it was either because I
piped the output through more or because I forgot
to paginate completely.

--
William Pursell


diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 986b7af..dc861c3 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -996,6 +996,12 @@ m4_define([_AC_INIT_HELP],
  #
  # Report the --help message.
  #
+if test "$PAGER" && test -n "$ac_init_help"; then
+  tmp=`mktemp -t base`
+  trap 'exec >&6; $PAGER $tmp; rm $tmp' 0
+  exec > $tmp
+fi
+
  if test "$ac_init_help" = "long"; then
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.



Re: [PATCH] paginate output of configure --help

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to William Pursell on 10/11/2008 10:27 AM:
> This may be a controversial patch, but I think that
> of all the times I have ever run configure --help
> without appending "|less" it was either because I
> piped the output through more or because I forgot
> to paginate completely.

Thanks for the idea; however, I'm not inclined to apply it.  Even if we
were to make autoconf output paged, we should do it consistently for all
output, not just --help.  If you always want to paginate, then you can
write a simple shell script wrapper or alias, which has the benefit of
working with existing configure scripts.  Besides, adding automatic paging
to configure would make autoconf behave different from other GNU tools,
which assume that if you want a pager, you will do the pipe yourself
(consider how long 'ls --help' is).

Furthermore, your patch still has some portability problems.  For example,
'test "$PAGER"' is not portable if PAGER begins with a '-', and you cannot
rely on the existence of mktemp.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjxB/IACgkQ84KuGfSFAYB7twCdGtGJfJi09DAB/UaLpnqnEtGS
yrIAniSjlfjglQFdTBJyI652vuYDrOBI
=pxqQ
-----END PGP SIGNATURE-----



Re: [PATCH] paginate output of configure --help

by william pursell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Blake wrote:
>
> Furthermore, your patch still has some portability problems.  For example,
> ... you cannot rely on the existence of mktemp.


I don't want to consume a lot of your time answering ignorant
questions from a newbie, but why is it that AS_TMPDIR is
able to use mktemp?

--
William Pursell



Re: [PATCH] paginate output of configure --help

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi William,

* William Pursell wrote on Sun, Oct 12, 2008 at 08:57:50AM CEST:
> Eric Blake wrote:
>>
>> Furthermore, your patch still has some portability problems.  For example,
>> ... you cannot rely on the existence of mktemp.
>
> I don't want to consume a lot of your time answering ignorant
> questions from a newbie, but why is it that AS_TMPDIR is
> able to use mktemp?

It provides an alternative method if mktemp did not provide a name.

Cheers,
Ralf


LightInTheBox - Buy quality products at wholesale price!