Akim Demaille wrote:
> Independently of the other thread we're having about set -e,
> I had refactored bootstrap a bit.
> -8<---
>
> * build-aux/bootstrap (stderr, die): New.
> Use them.
> ---
> build-aux/bootstrap | 94
> ++++++++++++++++++++++++++---------------------------
> 1 file changed, 47 insertions(+), 47 deletions(-)
>
> diff --git a/build-aux/bootstrap b/build-aux/bootstrap
> index e984910..ad94ef4 100755
> --- a/build-aux/bootstrap
> +++ b/build-aux/bootstrap
> @@ -1,6 +1,6 @@
> #! /bin/sh
> # Print a version string.
> -scriptversion=2012-07-03.20; # UTC
> +scriptversion=2012-07-06.08; # UTC
>
> # Bootstrap this package from checked-out sources.
>
> @@ -77,6 +77,16 @@ Running without arguments will suffice in most cases.
> EOF
> }
>
> +stderr()
> +{
> + for i
> + do
> + echo "$i"
> + done | sed -e "s/^/$me: /" >&2
> +}
> +
> +die() { stderr "$@"; exit 1; }
Hi Akim,
Thanks for the patch.
Those all look like improvements, but I'd prefer that
you change the name s/stderr/warn/: "stderr" is not normally
used as a verb.
Also, I am in the habit of writing e.g.,
warn this does not need quotes
With your implementation, that would print the expansion of:
$me: this
$me: does
$me: not
$me: need
$me: quotes
Something like the warn_ function in tests/init.sh (but without the
stderr_fileno_ bit) may do what we want: it's received pretty much testing.