diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-08-29 22:25:44 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-08-29 22:25:44 +0000 |
commit | fb80b8a8984779543f0f0c50d7f6dcb995e0ce96 (patch) | |
tree | edc635dbab544cc05ce647aafd59419607271596 /perl-install/commands.pm | |
parent | d5e061896a35a49a50124949c2882ac9cbe94589 (diff) | |
download | drakx-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar drakx-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar.gz drakx-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar.bz2 drakx-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.tar.xz drakx-fb80b8a8984779543f0f0c50d7f6dcb995e0ce96.zip |
no_comment
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r-- | perl-install/commands.pm | 29 |
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; + } +} |