From owner-freebsd-current Tue Jun 15 10:34:34 1999 Delivered-To: freebsd-current@freebsd.org Received: from aeolus.conio.net (ci221559-a.grnvle1.sc.home.com [24.4.122.122]) by hub.freebsd.org (Postfix) with SMTP id D2ADE14C18 for ; Tue, 15 Jun 1999 10:34:27 -0700 (PDT) (envelope-from sam@conio.net) Received: (qmail 3425 invoked from network); 15 Jun 1999 17:36:56 -0000 Received: from ci221559-b.grnvle1.sc.home.com (HELO thanatos) (24.4.122.130) by ci221559-a.grnvle1.sc.home.com with SMTP; 15 Jun 1999 17:36:56 -0000 From: "Sam Stephenson" To: , Subject: 'w' patch Date: Tue, 15 Jun 1999 13:38:29 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01BEB734.5AA5A4A0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2212 (4.71.2419.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. ------=_NextPart_000_0000_01BEB734.5AA5A4A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit There seem to be two problems (not even problems; more like annoyances) that exist in the 'w' command, both which involve unnecessary spacing that limits the size of the WHAT field. I have attached a patch to /usr/src/usr.bin/w/w.c which corrects the following: - The size of the USER field is now dynamically allocated as the length of the longest username, with a minimum of 5 spaces. In FreeBSD 2.2.x and lower, before long usernames existed, the field size was 8. It was enlarged to 16 to provide long username support, but on systems with shorter usernames, the wasted space can be bothersome. - UT_LINESIZE is redefined to 3; it was originally 5 because 'who' output shows the entire device name (e.g. ttyp0). Since 'w' only shows the 'p0' part, there are two unnecessary spaces. Please have a look at this patch, and consider implementing it into the source tree. --Sam Stephenson sam@conio.net ------=_NextPart_000_0000_01BEB734.5AA5A4A0 Content-Type: application/octet-stream; name="w.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="w.patch" 104a105,114=0A= > * UT_LINESIZE is 5 for who output, because the entire terminal device = name=0A= > * is shown (e.g. ttyp0). Since we only show the 'p0' in w, we'll = redefine=0A= > * this to 3 to save space.=0A= > */=0A= > #ifdef UT_LINESIZE=0A= > #undef UT_LINESIZE=0A= > #endif=0A= > #define UT_LINESIZE 3=0A= > =0A= > /*=0A= 138c148=0A= < int ch, i, nentries, nusers, wcmd, longidle;=0A= ---=0A= > int ch, i, nentries, nusers, wcmd, longidle, maxnamelen=3D5;=0A= 217a228,238=0A= > =0A= > /*=0A= > * Calculate the maximum number of spaces needed for=0A= > * each username. Previously 16; in 2.2.x and lower,=0A= > * when long usernames did not exist, 8 spaces were=0A= > * used. To avoid wasted space we will now do this=0A= > * dynamically.=0A= > */=0A= > if (strlen(utmp.ut_name) > maxnamelen)=0A= > maxnamelen =3D strlen(utmp.ut_name);=0A= > =0A= 252c273=0A= < #define WUSED (UT_NAMESIZE + UT_LINESIZE + UT_HOSTSIZE + \=0A= ---=0A= > #define WUSED (maxnamelen + UT_LINESIZE + UT_HOSTSIZE + \=0A= 255c276=0A= < UT_NAMESIZE, UT_NAMESIZE, HEADER_USER,=0A= ---=0A= > maxnamelen, maxnamelen, HEADER_USER,=0A= 382c403=0A= < UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name,=0A= ---=0A= > maxnamelen, maxnamelen, ep->utmp.ut_name,=0A= ------=_NextPart_000_0000_01BEB734.5AA5A4A0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message