Skip to content

Commit

Permalink
make -i not globaly set $error to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Lange committed Oct 18, 2017
1 parent 1878581 commit 821d67d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bin/fcopy
Expand Up @@ -102,7 +102,8 @@ sub copy_one {

# if no class matches, remove destination or move it to the backup file
unless (defined $class) {
ewarn("no matching file for any class for $source defined.");
warn "fcopy: no matching file for any class for $source defined.\n";
$error = 1 unless $opt_i; # do not set $error if -i was set
# do not copy
if ($opt_d and -f $destfile) {
print LOGFILE "$source\tNONE\t# removed (no matching class)\n" if $logfile;
Expand Down Expand Up @@ -554,5 +555,4 @@ if ($opt_r) {
}

foreach (@ARGV) { copy_one($source,$_,$target); }
$opt_i && exit 0; # ignore any warning
exit $error;
3 changes: 2 additions & 1 deletion man/fcopy.8
Expand Up @@ -67,7 +67,8 @@ Show help, version and summary of options.
If source is a symbolic link, make destination a symbolic link too.
.TP
.B \-i
Ignore warnings about no matching class and always exit with 0.
Ignore warnings about no matching class. These warnings will not set
the exit code to 1.
.TP
.BI "\-I " dir[,dir]
Override list of ignored directories when recursing. If not given, it is
Expand Down

0 comments on commit 821d67d

Please sign in to comment.