From df756e0046c5bf02d4902e4048a36464b0f8b258 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Thu, 6 Apr 2006 22:39:22 +0000 Subject: [PATCH] * lib/Autom4te/FileUtils.pm, lib/Autom4te/Struct.pm: Sync from Automake. --- ChangeLog | 3 +++ lib/Autom4te/FileUtils.pm | 31 +++++++++++++++---------------- lib/Autom4te/Struct.pm | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index aad22793..af3467fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-04-07 Ralf Wildenhues + * lib/Autom4te/FileUtils.pm, lib/Autom4te/Struct.pm: Sync + from Automake. + * doc/make-stds.texi: Sync from gnulib. 2006-04-06 Eric Blake diff --git a/lib/Autom4te/FileUtils.pm b/lib/Autom4te/FileUtils.pm index c8a5beb5..4b1f8927 100644 --- a/lib/Autom4te/FileUtils.pm +++ b/lib/Autom4te/FileUtils.pm @@ -207,18 +207,18 @@ sub up_to_date_p ($@) } -=item C +=item C Display an error message for C<$command>, based on the content of -C<$?> and C<$!>. +C<$?> and C<$!>. Be quiet if the command exited normally +with C<$expected_exit_code>. =cut -# handle_exec_errors ($COMMAND) -# ----------------------------- -sub handle_exec_errors ($) +sub handle_exec_errors ($;$) { - my ($command) = @_; + my ($command, $expected) = @_; + $expected = 0 unless defined $expected; $command = (split (' ', $command))[0]; if ($!) @@ -235,7 +235,8 @@ sub handle_exec_errors ($) # Propagate exit codes. fatal ('', "$command failed with exit status: $status", - exit_code => $status); + exit_code => $status) + unless $status == $expected; } elsif (WIFSIGNALED ($?)) { @@ -272,24 +273,22 @@ sub xqx ($) } -=item C +=item C -Same as C, but fails on errors, and reports the C<$command> +Same as C, but fails on errors, and reports the C<@argv> in verbose mode. =cut -# xsystem ($COMMAND) -# ------------------ -sub xsystem ($) +sub xsystem (@) { - my ($command) = @_; + my (@command) = @_; - verb "running: $command"; + verb "running: @command"; $! = 0; - handle_exec_errors $command - if system $command; + handle_exec_errors "@command" + if system @command; } diff --git a/lib/Autom4te/Struct.pm b/lib/Autom4te/Struct.pm index 36fdc2c3..7c7f3b51 100644 --- a/lib/Autom4te/Struct.pm +++ b/lib/Autom4te/Struct.pm @@ -508,7 +508,7 @@ accessor accordingly. The constructor of a generated class can be passed a list of I=>I pairs, with which to initialize the struct. If no initializer is specified for a particular element, its default -initialization is performed instead. Initializers for nonexistent +initialization is performed instead. Initializers for non-existent elements are silently ignored. Note that the initializer for a nested struct is specified