Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Apr 1998 10:12:55 -0700 (PDT)
From:      Pete Carah <pete@ns.altadena.net>
To:        bugs@FreeBSD.ORG
Subject:   Diffs for 'w' to handle long names right
Message-ID:  <199804141712.KAA01206@ns.altadena.net>

next in thread | raw e-mail | index | archive | help
I've long wanted to fix the 'w' headers to look right for long-name systems;
finally got a round tuit...

This diff applies to the 2.2-STABLE branch (cvsup'd late on 4/13) so I 
don't know how it is in 'current'.  This will work no matter what the 
name length is...
===================================================================
*** w.c.orig	Tue Apr 14 09:52:43 1998
--- w.c	Tue Apr 14 09:56:11 1998
***************
*** 245,253 ****
  		if (wcmd == 0)
  			exit (0);
  
! #define HEADER	"USER     TTY FROM              LOGIN@  IDLE WHAT\n"
! #define WUSED	(sizeof (HEADER) - sizeof ("WHAT\n"))
! 		(void)printf(HEADER);
  	}
  
  	if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)
--- 245,256 ----
  		if (wcmd == 0)
  			exit (0);
  
! #define HEADER1	"USER"
! #define HEADER2 "TTY FROM              LOGIN@  IDLE WHAT\n"
! #define WUSED	(sizeof (HEADER1) + sizeof(HEADER2) + 1 + UT_NAMESIZE - \
! 				 sizeof ("WHAT\n"))
! 		(void)printf("%-*.*s %s", UT_NAMESIZE, UT_NAMESIZE, HEADER1,
! 				HEADER2);
  	}
  
  	if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804141712.KAA01206>