From 878d786d14319e5cd8305d4d678e49c64dd9cc07 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 27 Dec 1999 21:47:08 +0000 Subject: no_comment --- perl-install/commands.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'perl-install/commands.pm') diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 320488197..fc4653b64 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -502,6 +502,30 @@ sub lspci { } sub dmesg { print cat_("/tmp/syslog"); } +sub sort { + my ($n, $h) = getopts(\@_, qw(nh)); + $h and die "usage: sort [-n] []\n"; + local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN); + if ($n) { + print sort { $a <=> $b } ; + } else { + print sort ; + } +} + +sub du { + my ($s, $h) = getopts(\@_, qw(sh)); + $h || !$s and die "usage: du -s []\n"; + + my $f; $f = sub { + my ($e) = @_; + my $s = (lstat($e))[12]; + $s += sum map { &$f($_) } glob_("$e/*") if !-l $e && -d $e; + $s; + }; + print &$f($_) >> 1, "\t$_\n" foreach @_ ? @_ : glob_("*"); +} + #my %cached_failed_install_cpio; #- double space between sub and install_cpio cuz install_cpio is not a shell command sub install_cpio($$;@) { -- cgit v1.2.1