From f4ecdc03d581ea2be9e6787987916553b1b54b20 Mon Sep 17 00:00:00 2001 From: srittau Date: Sun, 23 Feb 2003 03:09:22 +0000 Subject: [PATCH 1/1] * FIX: macusers script can now cope with IP addresses instead of host names. --- NEWS | 5 +++++ contrib/macusers/macusers.in | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 58ecd725..af0feaa7 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Changes in 1.6.2 +================ + +* FIX: macusers script can now cope with IP addresses instead of host names. + Changes in 1.6.1 ================ diff --git a/contrib/macusers/macusers.in b/contrib/macusers/macusers.in index 4796e8cc..0c44430b 100644 --- a/contrib/macusers/macusers.in +++ b/contrib/macusers/macusers.in @@ -42,7 +42,7 @@ if ($^O eq "freebsd") { $pid = $1; $addr = $2; $host = gethostbyaddr(pack('C4', split (/\./, $addr)), AF_INET); - ($host) = ($host =~ /(^[\w\d\-]+)/); + ($host) = ( $host =~ /(^(\d+\.){3}\d+|[\w\d\-]+)/ ); $mac{$pid} = $host; } print @@ -57,7 +57,7 @@ if ($^O eq "freebsd") { my ($pid, $host); $pid = $1; $host = $2; - ($host) = ($host =~ /(^[\w\d\-]+)/); + ($host) = ( $host =~ /(^(\d+\.){3}\d+|[\w\d\-]+)/ ); $mac{$pid} = $host; } print @@ -81,6 +81,7 @@ while () { if ($ppid != 1) { ($t, $t, $uid, $t, $t, $t, $name, $t, $t) = getpwnam($user); + ($name) = ( $name =~ /(^[^,]+)/ ); printf "%-8d %-8d %-16s %-20s %-9s %s\n", $pid, $uid, $user, $name, $time, $mac{$pid}; } -- 2.39.2