summaryrefslogtreecommitdiffstats
path: root/perl-install/commands.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-12-27 21:47:08 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-12-27 21:47:08 +0000
commit878d786d14319e5cd8305d4d678e49c64dd9cc07 (patch)
tree3655a4b7305c2a4fcb7e8e049a661a7e6026127a /perl-install/commands.pm
parenta5a0b5ba7e8ed4d5a0722dd9f88e3521119b2545 (diff)
downloaddrakx-backup-do-not-use-878d786d14319e5cd8305d4d678e49c64dd9cc07.tar
drakx-backup-do-not-use-878d786d14319e5cd8305d4d678e49c64dd9cc07.tar.gz
drakx-backup-do-not-use-878d786d14319e5cd8305d4d678e49c64dd9cc07.tar.bz2
drakx-backup-do-not-use-878d786d14319e5cd8305d4d678e49c64dd9cc07.tar.xz
drakx-backup-do-not-use-878d786d14319e5cd8305d4d678e49c64dd9cc07.zip
no_comment
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r--perl-install/commands.pm24
1 files changed, 24 insertions, 0 deletions
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] [<file>]\n";
+ local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN);
+ if ($n) {
+ print sort { $a <=> $b } <F>;
+ } else {
+ print sort <F>;
+ }
+}
+
+sub du {
+ my ($s, $h) = getopts(\@_, qw(sh));
+ $h || !$s and die "usage: du -s [<directories>]\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($$;@) {