diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-07-13 18:28:13 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-07-13 18:28:13 +0200 |
commit | 4c08c49f95803c35590fe11f8a2c5222a352be1c (patch) | |
tree | 42986811504698de6d24f6c5ce1bb6deeebf92d2 | |
parent | 524a7408265a2e349b9352fd6f979fc4783c116f (diff) |
checklinks: Minor code cleanup
-rwxr-xr-x | bin/checklinks | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/checklinks b/bin/checklinks index 7467ad4..0a3337a 100755 --- a/bin/checklinks +++ b/bin/checklinks @@ -7,7 +7,6 @@ use Getopt::Long; use Term::ANSIColor; my $base = $ENV{HOME}; -my ($type, $src, $dst); my $msglevel = 0; my $remove = 0; my %substitute; @@ -35,7 +34,7 @@ while(<$links>) { foreach my $key (keys(%substitute)) { s/\$$key/$substitute{$key}/g; } - ($type, $src, $dst) = split; + my ($type, $src, $dst) = split; next unless ($type eq 'soft' or $type eq 'hard'); if ($remove) { remove_link($src); @@ -54,6 +53,7 @@ sub remove_link { unlink("$base/$link") or warn("cannot unlink $base/$link: $!"); print_format('removed', $link, '', 'red', 1); } + return; } sub check_symlink { @@ -79,6 +79,7 @@ sub check_symlink { symlink($dst, "$base/$src"); print_format('fixed', $src, $dst, 'cyan', 1); } + return; } sub check_hardlink { @@ -101,6 +102,7 @@ sub check_hardlink { elsif ((stat("$base/$src"))[1] == (stat("$base/$dst"))[1]) { print_format('ok', $src, $dst, 'green', 0); } + return; } sub mkdirs { @@ -116,6 +118,7 @@ sub mkdirs { } $path .= $_; } + return; } sub print_format { @@ -132,6 +135,7 @@ sub print_format { printf('%-9s', $message); } printf(" %-15s -> %-15s\n", $src, $dst); + return; } exit($exit); |