From owner-freebsd-current Sat Jul 5 05:17:17 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id FAA04345 for current-outgoing; Sat, 5 Jul 1997 05:17:17 -0700 (PDT) Received: from nagual.pp.ru (ache.relcom.ru [194.58.229.133]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id FAA04340 for ; Sat, 5 Jul 1997 05:17:13 -0700 (PDT) Received: (from ache@localhost) by nagual.pp.ru (8.8.6/8.8.5) id QAA00551; Sat, 5 Jul 1997 16:16:43 +0400 (MSD) Date: Sat, 5 Jul 1997 16:16:38 +0400 (MSD) From: =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= To: David Nugent cc: Wolfram Schneider , current@FreeBSD.ORG Subject: Re: long usernames in top In-Reply-To: <199707051134.VAA01367@labs.usn.blaze.net.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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 http://www.nagual.pp.ru/~ache/