summaryrefslogtreecommitdiffstats
path: root/perl-install/commands.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-08-29 22:25:44 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-08-29 22:25:44 +0000
commitfb80b8a8984779543f0f0c50d7f6dcb995e0ce96 (patch)
treeedc635dbab544cc05ce647aafd59419607271596 /perl-install/commands.pm
parentd5e061896a35a49a50124949c2882ac9cbe94589 (diff)
downloaddrakx-backup-do-not-use-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar
drakx-backup-do-not-use-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar.gz
drakx-backup-do-not-use-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar.bz2
drakx-backup-do-not-use-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar.xz
drakx-backup-do-not-use-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.zip
no_comment
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r--perl-install/commands.pm29
1 files changed, 26 insertions, 3 deletions
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index e2c5ba97b..bd511c850 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -249,12 +249,12 @@ sub cp {
}
sub ps {
+
@_ and die "usage: ps\n";
my ($pid, $cpu, $cmd);
- my $uptime = int first(cat_("/proc/uptime"));
+ my ($uptime) = split ' ', first(cat_("/proc/uptime"));
my $hertz = 100;
- local (*STDOUT_TOP);
format STDOUT_TOP =
PID CMD
.
@@ -268,7 +268,7 @@ $pid, $cpu, $cmd
$cpu = sprintf "%2.1f", max(0, min(99, ($l[13] + $l[14]) * 100 / $hertz / ($uptime - $l[21] / $hertz)));
(($cmd) = cat_("/proc/$pid/cmdline")) =~ s/\0/ /g;
$cmd ||= (split ' ', (cat_("/proc/$pid/stat"))[0])[1];
- write STDOUT;
+ write;
}
}
@@ -397,3 +397,26 @@ sub insmod {
run_program::run("insmod_", $f, @_) or die("insmod $name failed");
unlink $f;
}
+
+sub route {
+ @ARGV and die "usage: route\nsorry, no modification handled\n";
+ my ($titles, @l) = cat_("/proc/net/route");
+ my @titles = split ' ', $titles;
+ my %l;
+ local *ROUTE = *STDOUT;
+ format ROUTE_TOP =
+Destination Gateway Mask Iface
+.
+ format ROUTE =
+@<<<<<<<<<<<< @<<<<<<<<<<<< @<<<<<<<<<<<< @<<<<<<<
+$l{Destination}, $l{Gateway}, $l{Mask}, $l{Iface}
+.
+ foreach (@l) {
+ /^\s*$/ and next;
+ @l{@titles} = split;
+ $_ = join ".", reverse map { hex } unpack "a2a2a2a2", $_ foreach @l{qw(Destination Gateway Mask)};
+ $l{Destination} = 'default' if $l{Destination} eq "0.0.0.0";
+ $l{Gateway} = '*' if $l{Gateway} eq "0.0.0.0";
+ write ROUTE;
+ }
+}