p - Don't ask for command when finished, exit directly
This commit is contained in:
parent
bd5a149cc0
commit
61efff731f
4
p
4
p
@ -27,19 +27,21 @@ sub printfile {
|
||||
print;
|
||||
&evalcmd unless ++$lines % $pagesize;
|
||||
}
|
||||
&evalcmd;
|
||||
}
|
||||
|
||||
unshift(@ARGV, '-') unless @ARGV;
|
||||
|
||||
my $n = $#ARGV;
|
||||
for (@ARGV) {
|
||||
if (/^-$/) {
|
||||
&printfile(\*STDIN);
|
||||
&evalcmd if $n--;
|
||||
} elsif (/^-(\d+)$/) {
|
||||
$pagesize = $1;
|
||||
} else {
|
||||
open(my $fh, '<', $_) or die "$0: Cannot open $_ for reading: $!";
|
||||
&printfile($fh);
|
||||
&evalcmd if $n--;
|
||||
close($fh);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user