2006-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ * lib/Autom4te/FileUtils.pm, lib/Autom4te/Struct.pm: Sync
+ from Automake.
+
* doc/make-stds.texi: Sync from gnulib.
2006-04-06 Eric Blake <ebb9@byu.net>
}
-=item C<handle_exec_errors ($command)>
+=item C<handle_exec_errors ($command, [$expected_exit_code = 0])>
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 ($!)
# Propagate exit codes.
fatal ('',
"$command failed with exit status: $status",
- exit_code => $status);
+ exit_code => $status)
+ unless $status == $expected;
}
elsif (WIFSIGNALED ($?))
{
}
-=item C<xsystem ($command)>
+=item C<xsystem (@argv)>
-Same as C<system>, but fails on errors, and reports the C<$command>
+Same as C<system>, 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;
}
The constructor of a generated class can be passed a list
of I<element>=>I<value> 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