Subject: Re: "who" question
To: Steven M. Bellovin <smb@research.att.com>
From: Mike Parson <mparson@bl.org>
List: netbsd-users
Date: 05/30/2001 16:25:11
In message <20010530110113.29F6C7B84@berkshire.research.att.com>, you write:
> In message <Pine.LNX.4.21.0105292225390.12431-100000@pilchuck.reedmedia.net>, "
> Jeremy C. Reed" writes:
>> On Mon, 28 May 2001 emre@vsrc.uab.edu wrote:
>>
>>> When I type "who" I can see all users logged on and the hosst they are
>>> logged from. But somehow I can only see part of the hostname (if it's
>>> too long). Is there a way to make it show the full hostname?
>>
>> /usr/src/usr.bin/who/who.c uses:
>>
>> printf("\t(%.*s)", (int)UT_HOSTSIZE, up-> ut_host);
>>
>> UT_HOSTSIZE is 16.
>>
>> It would be interesting to add an option for no cropped strings; here is
>> something to try (use the -N switch):
>
> Without having tried your fix, it's extremely improbable that it would
> work -- the problem is that the utmp structure has 16-byte host names,
> and that's all that's recorded at login time. Your fix, in fact, is
> likely to cause lots of garbage output, since truncated host entries
> aren't null-terminated.
How about something more along the lines of Linux's 'last -da'
The -a flag puts the host info in the last column and the -d flag
forces the OS to take the stored IP and re-look it up instead of
using the stored hostname info. This would require that wtmp store
the IP as well as the hostname, which I'm not sure if NetBSD does.
--
Michael Parson
mparson@bl.org