From eaa18fd91c51c136ff6ec607d46d32b87a2ea34f Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Sat, 14 Nov 2015 03:03:55 +0100 Subject: Remove prototypes and make sure subs are called with () --- sboclean | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'sboclean') diff --git a/sboclean b/sboclean index 4a2c131..0883bb2 100755 --- a/sboclean +++ b/sboclean @@ -19,7 +19,7 @@ use File::Path qw(remove_tree); my $self = basename($0); -sub show_usage() { +sub show_usage { print < \$interactive, ); -show_usage and exit 0 if $help; -show_version and exit 0 if $vers; +show_usage() and exit 0 if $help; +show_version() and exit 0 if $vers; -usage_error "You must specify at least one of -d or -w." unless +usage_error("You must specify at least one of -d or -w.") unless ($clean_dist || $clean_work); -sub rm_full($) { - exists $_[0] or script_error 'rm_full requires an argument.'; +sub rm_full { + exists $_[0] or script_error('rm_full requires an argument.'); my $full = shift; if ($interactive) { print "Remove $full? [n] "; @@ -66,27 +66,27 @@ sub rm_full($) { return 1; } -sub remove_stuff($) { +sub remove_stuff { exists $_[0] or script_error 'remove_stuff requires an argument.'; -d $_[0] or say 'Nothing to do.' and return 1; my $dir = shift; opendir(my $dh, $dir); FIRST: while (my $ls = readdir $dh) { next FIRST if $ls =~ /^(\.){1,2}$/; - rm_full "$dir/$ls"; + rm_full("$dir/$ls"); } } -sub clean_c32() { +sub clean_c32 { my $dir = $SBO::Lib::tmpd; opendir(my $dh, $dir); FIRST: while (my $ls = readdir $dh) { next FIRST unless $ls =~ /^package-.+-compat32$/; - rm_full "$dir/$ls"; + rm_full("$dir/$ls"); } } -remove_stuff $config{SBO_HOME} .'/distfiles' if $clean_dist; +remove_stuff($config{SBO_HOME} .'/distfiles') if $clean_dist; if ($clean_work) { my $env_tmp = $SBO::Lib::env_tmp; @@ -94,11 +94,11 @@ if ($clean_work) { if ($env_tmp && !$interactive) { warn "This will remove the entire contents of $env_tmp\n"; print "Proceed? [y] "; - remove_stuff $tsbo if =~ /^[yY\n]/; + remove_stuff($tsbo) if =~ /^[yY\n]/; } else { - remove_stuff $tsbo; + remove_stuff($tsbo); } - clean_c32; + clean_c32(); } exit 0; -- cgit v1.2.3