From 2d3b13d3b7e6f08f6310467ece7d399c5858d233 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 28 Aug 1999 10:19:54 +0000 Subject: no_comment --- perl-install/commands.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'perl-install/commands.pm') diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 44a49a17f..1e09d7329 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -274,8 +274,9 @@ $pid, $cpu, $cmd sub dd { - my $u = "usage: dd [-h] [if=] [of=] [bs=] [count=]\n"; - (getopts(\@_, qw(h)))[0] and die $u; + my $u = "usage: dd [-h] [-p] [if=] [of=] [bs=] [count=]\n"; + my ($help, $percent) = getopts(\@_, qw(hp)); + die $u if $help; my %h = (if => \*STDIN, of => \*STDOUT, bs => 512, count => undef); foreach (@_) { /(.*?)=(.*)/ && exists $h{$1} or die $u; @@ -290,12 +291,13 @@ sub dd { $h{bs} =~ /(\d+)G$/ and $h{bs} = $1 * 1024 * 1024 * 1024; for ($nb = 0; !$h{count} || $nb < $h{count}; $nb++) { + printf "\r%02.1d%%", 100 * $nb / $h{count} if $h{count} && $percent; $read = sysread(IF, $tmp, $h{bs}) or $h{count} ? die "error: can't read block $nb\n" : last; syswrite(OF, $tmp) or die "error: can't write block $nb\n"; $read < $h{bs} and $read = 1, last; } - print STDERR "$nb+$read records in\n"; - print STDERR "$nb+$read records out\n"; + print STDERR "\r$nb+$read records in\n"; + print STDERR "$nb+$read records out\n"; } sub head_tail { -- cgit v1.2.1