Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jul 1997 16:16:38 +0400 (MSD)
From:      =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru>
To:        David Nugent <davidn@labs.usn.blaze.net.au>
Cc:        Wolfram Schneider <wosch@apfel.de>, current@FreeBSD.ORG
Subject:   Re: long usernames in top 
Message-ID:  <Pine.BSF.3.96.970705161359.545A-100000@nagual.pp.ru>
In-Reply-To: <199707051134.VAA01367@labs.usn.blaze.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 5 Jul 1997, David Nugent wrote:

> int getmaxnamelen(void)
> {
>   int maxnamelen = 8;
>   struct passwd *pw;

> 
> Use this to determine the maximum name. 8 is an obvious minimum, and
> do this at startup. If larger names are added while top is running,
> well, tough, they get truncated which is no big deal.

Better variant will be to calculate maxnamelen at runtime through
displayed names only, not through all names from /etc/passwd

Otherwise you'll get wide output even if only one long user name present
in your /etc/passwd (even this userid is never really used).

-- 
Andrey A. Chernov
<ache@null.net>
http://www.nagual.pp.ru/~ache/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970705161359.545A-100000>