[net.bugs.4bsd] Sa -u prints garbage

steve@tellab3.UUCP (Steve Harpster) (08/23/84)

Subject: Sa produces garbage with -u option
Index:	etc/sa 4.2BSD (fix)

Description:
	The option -u on sa produces bogus numbers and commands.
Repeat-By:
	/etc/sa -u
Fix:
	The problem is with a printf() thinking that its arguments are
	of a different type then what they really are. Casts correct
	the problem. I also added in group id's as well. Diffs follow:

*** oldsa.c	Thu Aug 23 10:16:04 1984
--- sa.c	Thu Aug 23 10:21:35 1984
***************
*** 633,638
  		y = fbuf.ac_mem;
  		z = expand(fbuf.ac_io);
  		if (uflg) {
  			printf("%3d%6.1fcp %6dmem %6dio %.14s\n",
  			    fbuf.ac_uid, x, y, z, fbuf.ac_comm);
  			continue;

--- 633,643 -----
  		y = fbuf.ac_mem;
  		z = expand(fbuf.ac_io);
  		if (uflg) {
+ #ifdef TELLABS3
+ 			printf("%3duid%6dgid%6.1fcp %6dmem %6dio %.14s\n",
+ 			    fbuf.ac_uid, fbuf.ac_gid, (float) x, (int) y,
+ 			    (int) z, fbuf.ac_comm);
+ #else
  			printf("%3d%6.1fcp %6dmem %6dio %.14s\n",
  			    fbuf.ac_uid, x, y, z, fbuf.ac_comm);
  #endif
***************
*** 635,640
  		if (uflg) {
  			printf("%3d%6.1fcp %6dmem %6dio %.14s\n",
  			    fbuf.ac_uid, x, y, z, fbuf.ac_comm);
  			continue;
  		}
  		up = finduser(fbuf.ac_uid);

--- 640,646 -----
  #else
  			printf("%3d%6.1fcp %6dmem %6dio %.14s\n",
  			    fbuf.ac_uid, x, y, z, fbuf.ac_comm);
+ #endif
  			continue;
  		}
  		up = finduser(fbuf.ac_uid);


-- 
...ihnp4!tellab1!steve
Steve Harpster
Tellabs, Inc.