Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 May 1998 05:13:21 -0700
From:      Studded <Studded@san.rr.com>
To:        Joseph Koshy <jkoshy@FreeBSD.ORG>
Cc:        cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/usr.bin/w w.c
Message-ID:  <35641A61.6ABDB051@san.rr.com>
References:  <199805210846.BAA19773@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35641A61.6ABDB051>