From owner-cvs-all Thu May 21 05:13:28 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA26141 for cvs-all-outgoing; Thu, 21 May 1998 05:13:28 -0700 (PDT) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from dt050n33.san.rr.com (@dt053nd2.san.rr.com [204.210.34.210]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA26128; Thu, 21 May 1998 05:13:22 -0700 (PDT) (envelope-from Studded@san.rr.com) Received: from san.rr.com (Studded@localhost [127.0.0.1]) by dt050n33.san.rr.com (8.8.8/8.8.8) with ESMTP id FAA25089; Thu, 21 May 1998 05:13:22 -0700 (PDT) (envelope-from Studded@san.rr.com) Message-ID: <35641A61.6ABDB051@san.rr.com> Date: Thu, 21 May 1998 05:13:21 -0700 From: Studded Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.05 [en] (X11; I; FreeBSD 2.2.6-STABLE-0507 i386) MIME-Version: 1.0 To: Joseph Koshy CC: cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/usr.bin/w w.c References: <199805210846.BAA19773@freefall.freebsd.org> Content-Type: multipart/mixed; boundary="------------15BE0815C7DBD68765B4E940" Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk This is a multi-part message in MIME format. --------------15BE0815C7DBD68765B4E940 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Joseph Koshy wrote: > > jkoshy 1998/05/21 01:46:49 PDT > > Modified files: > usr.bin/w w.c > Log: > Cosmetic fix. Compute header field widths from UT_{HOST,LINE,NAME}SIZE > instead of hardcoding header line. Errr... after I mailed asking if you could bring w.c in -Stable up to -Current level I got to playing around with this a bit and realized that 8 characters seems like an awful lot for the TTY display. If there is no situation where you'd want more than 999 vty's and/or there is no situation where that field could be > 4, I would suggest this patch (comment optional of course, just trying to give an idea as to what I'm up to :). This applies to w.c version 1.27. Compiles and runs clean on -Stable too. :) Thanks, Doug -- *** Chief Operations Officer, DALnet IRC network *** *** Proud designer and maintainer of one of the world's largest *** Internet Relay Chat server with 5,328 simultaneous connections *** Try spider.dal.net on ports 6662-4 (Powered by FreeBSD) --------------15BE0815C7DBD68765B4E940 Content-Type: text/plain; charset=us-ascii; name="w.c.tty-space.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="w.c.tty-space.diff" --- w.c.Dist Thu May 21 05:01:27 1998 +++ w.c Thu May 21 05:00:52 1998 @@ -251,11 +251,14 @@ #define HEADER_FROM "FROM" #define HEADER_LOGIN_IDLE "LOGIN@ IDLE " #define HEADER_WHAT "WHAT\n" -#define WUSED (UT_NAMESIZE + UT_LINESIZE + UT_HOSTSIZE + \ + /* 8 characters for the TTY display wastes space. Perhaps + * it would be better to just #define this to 4? */ +#define UT_LINESIZE_HALF UT_LINESIZE / 2 +#define WUSED (UT_NAMESIZE + UT_LINESIZE_HALF + UT_HOSTSIZE + \ sizeof(HEADER_LOGIN_IDLE) + 3) /* header width incl. spaces */ (void)printf("%-*.*s %-*.*s %-*.*s %s", UT_NAMESIZE, UT_NAMESIZE, HEADER_USER, - UT_LINESIZE, UT_LINESIZE, HEADER_TTY, + UT_LINESIZE_HALF, UT_LINESIZE_HALF, HEADER_TTY, UT_HOSTSIZE, UT_HOSTSIZE, HEADER_FROM, HEADER_LOGIN_IDLE HEADER_WHAT); } @@ -383,7 +386,7 @@ } (void)printf("%-*.*s %-*.*s %-*.*s ", UT_NAMESIZE, UT_NAMESIZE, ep->utmp.ut_name, - UT_LINESIZE, UT_LINESIZE, + UT_LINESIZE_HALF, UT_LINESIZE_HALF, strncmp(ep->utmp.ut_line, "tty", 3) && strncmp(ep->utmp.ut_line, "cua", 3) ? ep->utmp.ut_line : ep->utmp.ut_line + 3, --------------15BE0815C7DBD68765B4E940-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message