Fix inconsistencies in coding style.
This commit is contained in:
parent
6ee8747c9b
commit
85f1f8619c
2 changed files with 85 additions and 115 deletions
32
stow.in
32
stow.in
|
@ -164,7 +164,6 @@ if ( not caller() ) {
|
||||||
# Comments : checks @ARGV for valid package names
|
# Comments : checks @ARGV for valid package names
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub process_options {
|
sub process_options {
|
||||||
|
|
||||||
get_defaults();
|
get_defaults();
|
||||||
#$,="\n"; print @ARGV,"\n"; # for debugging rc file
|
#$,="\n"; print @ARGV,"\n"; # for debugging rc file
|
||||||
|
|
||||||
|
@ -278,7 +277,6 @@ sub debug {
|
||||||
# : hacked in so that Emil and I could set different preferences).
|
# : hacked in so that Emil and I could set different preferences).
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
sub get_defaults {
|
sub get_defaults {
|
||||||
|
|
||||||
my @defaults = ();
|
my @defaults = ();
|
||||||
for my $file ($ENV{'HOME'}.'/.stowrc', '.stowrc') {
|
for my $file ($ENV{'HOME'}.'/.stowrc', '.stowrc') {
|
||||||
if (-r $file) {
|
if (-r $file) {
|
||||||
|
@ -341,7 +339,7 @@ OPTIONS:
|
||||||
-V, --version Show stow version number
|
-V, --version Show stow version number
|
||||||
-h, --help Show this help
|
-h, --help Show this help
|
||||||
EOT
|
EOT
|
||||||
exit( $msg ? 1 : 0 );
|
exit $msg ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#===== SUBROUTINE ===========================================================
|
#===== SUBROUTINE ===========================================================
|
||||||
|
@ -354,7 +352,6 @@ EOT
|
||||||
# Comments : This sets the current working directory to $Option{target}
|
# Comments : This sets the current working directory to $Option{target}
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub set_stow_path {
|
sub set_stow_path {
|
||||||
|
|
||||||
# Changing dirs helps a lot when soft links are used
|
# Changing dirs helps a lot when soft links are used
|
||||||
# Also prevents problems when 'stow_dir' or 'target' are
|
# Also prevents problems when 'stow_dir' or 'target' are
|
||||||
# supplied as relative paths (FIXME: examples?)
|
# supplied as relative paths (FIXME: examples?)
|
||||||
|
@ -404,7 +401,6 @@ sub set_stow_path {
|
||||||
# : $path is used for folding/unfolding trees as necessary
|
# : $path is used for folding/unfolding trees as necessary
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub stow_contents {
|
sub stow_contents {
|
||||||
|
|
||||||
my ($path, $target, $source) = @_;
|
my ($path, $target, $source) = @_;
|
||||||
|
|
||||||
debug(2, "Stowing contents of $path");
|
debug(2, "Stowing contents of $path");
|
||||||
|
@ -445,7 +441,6 @@ sub stow_contents {
|
||||||
# : $path is used for folding/unfolding trees as necessary
|
# : $path is used for folding/unfolding trees as necessary
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub stow_node {
|
sub stow_node {
|
||||||
|
|
||||||
my ($path, $target, $source) = @_;
|
my ($path, $target, $source) = @_;
|
||||||
|
|
||||||
debug(2, "Stowing $path");
|
debug(2, "Stowing $path");
|
||||||
|
@ -547,7 +542,6 @@ sub stow_node {
|
||||||
# : Here we traverse the target tree, rather than the source tree.
|
# : Here we traverse the target tree, rather than the source tree.
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub unstow_contents_orig {
|
sub unstow_contents_orig {
|
||||||
|
|
||||||
my ($path, $target) = @_;
|
my ($path, $target) = @_;
|
||||||
|
|
||||||
# don't try to remove anything under a stow directory
|
# don't try to remove anything under a stow directory
|
||||||
|
@ -587,7 +581,6 @@ sub unstow_contents_orig {
|
||||||
# Comments : unstow_node() and unstow_contents() are mutually recursive
|
# Comments : unstow_node() and unstow_contents() are mutually recursive
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub unstow_node_orig {
|
sub unstow_node_orig {
|
||||||
|
|
||||||
my ($path, $target) = @_;
|
my ($path, $target) = @_;
|
||||||
|
|
||||||
debug(2, "Unstowing $target");
|
debug(2, "Unstowing $target");
|
||||||
|
@ -649,7 +642,6 @@ sub unstow_node_orig {
|
||||||
# : Here we traverse the target tree, rather than the source tree.
|
# : Here we traverse the target tree, rather than the source tree.
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub unstow_contents {
|
sub unstow_contents {
|
||||||
|
|
||||||
my ($path, $target) = @_;
|
my ($path, $target) = @_;
|
||||||
|
|
||||||
# don't try to remove anything under a stow directory
|
# don't try to remove anything under a stow directory
|
||||||
|
@ -692,7 +684,6 @@ sub unstow_contents {
|
||||||
# Comments : unstow_node() and unstow_contents() are mutually recursive
|
# Comments : unstow_node() and unstow_contents() are mutually recursive
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub unstow_node {
|
sub unstow_node {
|
||||||
|
|
||||||
my ($path, $target) = @_;
|
my ($path, $target) = @_;
|
||||||
|
|
||||||
debug(2, "Unstowing $path");
|
debug(2, "Unstowing $path");
|
||||||
|
@ -784,7 +775,6 @@ sub unstow_node {
|
||||||
# : we could put more logic under here for multiple stow dirs
|
# : we could put more logic under here for multiple stow dirs
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub find_stowed_path {
|
sub find_stowed_path {
|
||||||
|
|
||||||
my ($target, $source) = @_;
|
my ($target, $source) = @_;
|
||||||
|
|
||||||
# evaluate softlink relative to its target
|
# evaluate softlink relative to its target
|
||||||
|
@ -829,7 +819,6 @@ sub find_stowed_path {
|
||||||
# : it anyway
|
# : it anyway
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
sub cleanup_invalid_links {
|
sub cleanup_invalid_links {
|
||||||
|
|
||||||
my ($dir) = @_;
|
my ($dir) = @_;
|
||||||
|
|
||||||
if (not -d $dir) {
|
if (not -d $dir) {
|
||||||
|
@ -881,7 +870,6 @@ sub cleanup_invalid_links {
|
||||||
# : that is, it can be used as the source for a replacement symlink
|
# : that is, it can be used as the source for a replacement symlink
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub foldable {
|
sub foldable {
|
||||||
|
|
||||||
my ($target) = @_;
|
my ($target) = @_;
|
||||||
|
|
||||||
debug(3, "--- Is $target foldable?");
|
debug(3, "--- Is $target foldable?");
|
||||||
|
@ -947,7 +935,6 @@ sub foldable {
|
||||||
# Comments : only called iff foldable() is true so we can remove some checks
|
# Comments : only called iff foldable() is true so we can remove some checks
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub fold_tree {
|
sub fold_tree {
|
||||||
|
|
||||||
my ($target, $source) = @_;
|
my ($target, $source) = @_;
|
||||||
|
|
||||||
debug(3, "--- Folding tree: $target => $source");
|
debug(3, "--- Folding tree: $target => $source");
|
||||||
|
@ -997,7 +984,6 @@ sub conflict {
|
||||||
# Comments : none
|
# Comments : none
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
sub ignore {
|
sub ignore {
|
||||||
|
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
for my $suffix (@{$Option{'ignore'}}) {
|
for my $suffix (@{$Option{'ignore'}}) {
|
||||||
|
@ -1015,7 +1001,6 @@ sub ignore {
|
||||||
# Comments : none
|
# Comments : none
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
sub defer {
|
sub defer {
|
||||||
|
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
for my $prefix (@{$Option{'defer'}}) {
|
for my $prefix (@{$Option{'defer'}}) {
|
||||||
|
@ -1033,7 +1018,6 @@ sub defer {
|
||||||
# Comments : none
|
# Comments : none
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
sub override {
|
sub override {
|
||||||
|
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
for my $regex (@{$Option{'override'}}) {
|
for my $regex (@{$Option{'override'}}) {
|
||||||
|
@ -1059,7 +1043,6 @@ sub override {
|
||||||
# : an action is set to 'skip' if it is found to be redundant
|
# : an action is set to 'skip' if it is found to be redundant
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub process_tasks {
|
sub process_tasks {
|
||||||
|
|
||||||
debug(2, "Processing tasks...");
|
debug(2, "Processing tasks...");
|
||||||
|
|
||||||
# strip out all tasks with a skip action
|
# strip out all tasks with a skip action
|
||||||
|
@ -1126,9 +1109,7 @@ sub process_tasks {
|
||||||
sub is_a_link {
|
sub is_a_link {
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
|
|
||||||
if (exists $Link_Task_For{$path}) {
|
if (exists $Link_Task_For{$path}) {
|
||||||
|
|
||||||
my $action = $Link_Task_For{$path}->{'action'};
|
my $action = $Link_Task_For{$path}->{'action'};
|
||||||
|
|
||||||
if ($action eq 'remove') {
|
if ($action eq 'remove') {
|
||||||
|
@ -1215,7 +1196,6 @@ sub is_a_node {
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
if (exists $Link_Task_For{$path}) {
|
if (exists $Link_Task_For{$path}) {
|
||||||
|
|
||||||
my $action = $Link_Task_For{$path}->{'action'};
|
my $action = $Link_Task_For{$path}->{'action'};
|
||||||
|
|
||||||
if ($action eq 'remove') {
|
if ($action eq 'remove') {
|
||||||
|
@ -1230,7 +1210,6 @@ sub is_a_node {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists $Dir_Task_For{$path}) {
|
if (exists $Dir_Task_For{$path}) {
|
||||||
|
|
||||||
my $action = $Dir_Task_For{$path}->{'action'};
|
my $action = $Dir_Task_For{$path}->{'action'};
|
||||||
|
|
||||||
if ($action eq 'remove') {
|
if ($action eq 'remove') {
|
||||||
|
@ -1270,7 +1249,6 @@ sub is_a_node {
|
||||||
# Comments : none
|
# Comments : none
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub read_a_link {
|
sub read_a_link {
|
||||||
|
|
||||||
my ($path) = @_;
|
my ($path) = @_;
|
||||||
|
|
||||||
if (exists $Link_Task_For{$path}) {
|
if (exists $Link_Task_For{$path}) {
|
||||||
|
@ -1304,11 +1282,9 @@ sub read_a_link {
|
||||||
# Comments : cleans up operations that undo previous operations
|
# Comments : cleans up operations that undo previous operations
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub do_link {
|
sub do_link {
|
||||||
|
|
||||||
my ($oldfile, $newfile) = @_;
|
my ($oldfile, $newfile) = @_;
|
||||||
|
|
||||||
if (exists $Dir_Task_For{$newfile}) {
|
if (exists $Dir_Task_For{$newfile}) {
|
||||||
|
|
||||||
my $task_ref = $Dir_Task_For{$newfile};
|
my $task_ref = $Dir_Task_For{$newfile};
|
||||||
|
|
||||||
if ($task_ref->{'action'} eq 'create') {
|
if ($task_ref->{'action'} eq 'create') {
|
||||||
|
@ -1329,7 +1305,6 @@ sub do_link {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists $Link_Task_For{$newfile}) {
|
if (exists $Link_Task_For{$newfile}) {
|
||||||
|
|
||||||
my $task_ref = $Link_Task_For{$newfile};
|
my $task_ref = $Link_Task_For{$newfile};
|
||||||
|
|
||||||
if ($task_ref->{'action'} eq 'create') {
|
if ($task_ref->{'action'} eq 'create') {
|
||||||
|
@ -1383,7 +1358,6 @@ sub do_link {
|
||||||
# Comments : will remove an existing planned link
|
# Comments : will remove an existing planned link
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub do_unlink {
|
sub do_unlink {
|
||||||
|
|
||||||
my ($file) = @_;
|
my ($file) = @_;
|
||||||
|
|
||||||
if (exists $Link_Task_For{$file}) {
|
if (exists $Link_Task_For{$file}) {
|
||||||
|
@ -1444,7 +1418,6 @@ sub do_mkdir {
|
||||||
my ($dir) = @_;
|
my ($dir) = @_;
|
||||||
|
|
||||||
if (exists $Link_Task_For{$dir}) {
|
if (exists $Link_Task_For{$dir}) {
|
||||||
|
|
||||||
my $task_ref = $Link_Task_For{$dir};
|
my $task_ref = $Link_Task_For{$dir};
|
||||||
|
|
||||||
if ($task_ref->{'action'} eq 'create') {
|
if ($task_ref->{'action'} eq 'create') {
|
||||||
|
@ -1463,7 +1436,6 @@ sub do_mkdir {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists $Dir_Task_For{$dir}) {
|
if (exists $Dir_Task_For{$dir}) {
|
||||||
|
|
||||||
my $task_ref = $Dir_Task_For{$dir};
|
my $task_ref = $Dir_Task_For{$dir};
|
||||||
|
|
||||||
if ($task_ref->{'action'} eq 'create') {
|
if ($task_ref->{'action'} eq 'create') {
|
||||||
|
@ -1562,7 +1534,6 @@ sub do_rmdir {
|
||||||
# Comments : none
|
# Comments : none
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
sub strip_quotes {
|
sub strip_quotes {
|
||||||
|
|
||||||
my ($string) = @_;
|
my ($string) = @_;
|
||||||
|
|
||||||
if ($string =~ m{\A\s*'(.*)'\s*\z}) {
|
if ($string =~ m{\A\s*'(.*)'\s*\z}) {
|
||||||
|
@ -1584,7 +1555,6 @@ sub strip_quotes {
|
||||||
# : '//' => '/' and 'a/b/../c' => 'a/c'
|
# : '//' => '/' and 'a/b/../c' => 'a/c'
|
||||||
#============================================================================
|
#============================================================================
|
||||||
sub join_paths {
|
sub join_paths {
|
||||||
|
|
||||||
my @paths = @_;
|
my @paths = @_;
|
||||||
|
|
||||||
# weed out empty components and concatenate
|
# weed out empty components and concatenate
|
||||||
|
|
Loading…
Reference in a new issue