home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
-
- $cols = ($ENV{"TERMCAP"} =~ /:co#(\d+):/) ? $1 : 80;
-
- $PIPE = "/bin/who|";
- open PIPE || die "$0: can't open $PIPE: $!\n";
-
- while (<PIPE>) {
- chop; split;
- $users{$_[1]} = $_[0];
- next unless $#_ > 4;
- ( $whence = $_[5] ) =~ s/^\((.*)\)$/\1/;
- $whence =~ s/(.*):.*/$1/;
- $whence =~ s/(................).*/$1/;
- $whence =~ s/\.convex\.(c(o(m)?)?)?$//;
- $whence =~ s/^130\.168\.//;
- $whence{$_[1]} = $whence;
- }
-
- $PIPE = "/usr/ucb/w " . join(' ', @ARGV) . "|"; open PIPE || die "$0: can't open $PIPE: $!\n";
- $_ = <PIPE>; print;
-
- $_ = <PIPE>;
- s/^(.................).(.*)$/$1whence $2/;
- print;
-
- while (<PIPE>) {
- chop; split;
- $whence = ($users{$_[1]} eq $_[0]) ? $whence{$_[1]} : "(new login)";
- /(.................).(.*)/;
- $line = sprintf ("%s%-10s%s", $1, $whence, $2);
- eval '$line =~ s/^(' . ('.' x $cols) . ').*/$1/';
- print $line,"\n";
- }
-