--- a/amdumpext Wed Dec 11 22:24:11 2013 +0100
+++ b/amdumpext Wed Dec 11 22:37:00 2013 +0100
@@ -29,10 +29,10 @@
# the commands we need to support as required by the
# API: http://wiki.zmanda.com/index.php/Application_API/Operations
-sub exit_support;
-sub exit_selfcheck;
-sub exit_estimate;
-sub exit_backup;
+sub exec_support;
+sub exec_selfcheck;
+sub exec_estimate;
+sub exec_backup;
# some helper functions
@@ -76,25 +76,21 @@
) or pod2usage(-message => "$0 @argv");
given ($command) {
- when ("support") { exit_support }
- when ("selfcheck") { exit_selfcheck }
- when ("estimate") { exit_estimate }
- when ("backup") { exit_backup }
+ when ("support") { exec_support }
+ when ("selfcheck") { exec_selfcheck }
+ when ("estimate") { exec_estimate }
+ when ("backup") { exec_backup }
}
pod2usage(-message => "$0 @argv");
}
# output a list of supported options
-sub exit_support {
- print map {
- map { y/_/-/; $_ }
- $_
- . " $SUPPORT{$_}\n"
- } keys %SUPPORT;
+sub exec_support {
+ print map { "$_ $SUPPORT{$_}\n" =~ s/_/-/gr } keys %SUPPORT;
exit 0;
}
-sub exit_selfcheck {
+sub exec_selfcheck {
if ($_ = (grep { -x ($_ .= "/dump") } split /:/ => $ENV{PATH})[0]) {
OK "dump is \"$_\"";
@@ -121,7 +117,7 @@
exit 0;
}
-sub exit_estimate {
+sub exec_estimate {
# $opt_level, $opt_device
my @cmd = (
@@ -146,7 +142,7 @@
exit 0;
}
-sub exit_backup {
+sub exec_backup {
# fd1: data channel
# fd3: message channel