Skip to content

Commit

Permalink
Merge pull request #284 from mknos/tail-checknum
Browse files Browse the repository at this point in the history
tail: check_number() too forgiving
  • Loading branch information
briandfoy authored Oct 10, 2023
2 parents c519395 + 10e79a2 commit f873ba0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/tail
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ my $block_size = 512;
sub check_number($)
{
my $opt = shift;
if ($opt =~ /\+(\d+)$/) {
return $1+0;
} elsif ($opt =~ /-?(\d+)$/) {
return -($1+0);
if ($opt =~ m/\A\+(\d+)\Z/) {
return $1+0;
} elsif ($opt =~ m/\A\-?(\d+)\Z/) {
return -($1+0);
} else {
usage(1);
usage(1, "invalid number '$opt'");
}
}

Expand Down

0 comments on commit f873ba0

Please sign in to comment.