[comp.bugs.4bsd] 4.3BSD ucb/systat +fix

brighton@pixar.UUCP (Bill Carson) (04/21/87)

Index:	ucb/systat/{cmds.c,netcmds.c,vmstat.c} 4.3BSD

Description:

	1) In cmds.c:command(), lookup() returns the wrong status value
	
	2) In netcmds.c:changeitems(), selectport() is being passed a 
		character string, not a numeric port number.

	3) In vmstat.c:showkre(), when a disk is deleted/added to the display,
		the disk names do not change.

Repeat-By:

	1) try to use any of the sub-commands in each display.

	2) try to "ignore" a port in the netstat display.

	3) "add" or "delete" a disk name in the vmstat display, the 
		statistics will move, but the disk names won't.

Fix:
	Apply the following patch in the systat source directory.

*** orig/cmds.c	Thu Apr  9 14:06:30 1987
--- cmds.c	Tue Mar 24 23:23:45 1987
***************
*** 123,129 ****
  
  	longest = 0;
  	nmatches = 0;
! 	found = (struct cmdtab *)-1;
  	for (c = cmdtab; p = c->c_name; c++) {
  		for (q = name; *q == *p++; q++)
  			if (*q == 0)		/* exact match? */
--- 123,129 ----
  
  	longest = 0;
  	nmatches = 0;
! 	found = (struct cmdtab *)0;
  	for (c = cmdtab; p = c->c_name; c++) {
  		for (q = name; *q == *p++; q++)
  			if (*q == 0)		/* exact match? */
*** orig/netcmds.c	Thu Apr  9 14:06:40 1987
--- netcmds.c	Tue Mar 24 23:24:15 1987
***************
*** 91,97 ****
  		sp = getservbyname(args,
  		    protos == TCP ? "tcp" : protos == UDP ? "udp" : 0);
  		if (sp) {
! 			selectport(sp->s_name, onoff);
  			continue;
  		}
  		hp = gethostbyname(args);
--- 91,97 ----
  		sp = getservbyname(args,
  		    protos == TCP ? "tcp" : protos == UDP ? "udp" : 0);
  		if (sp) {
! 			selectport(sp->s_port, onoff);
  			continue;
  		}
  		hp = gethostbyname(args);
*** orig/vmstat.c	Thu Apr  9 14:06:44 1987
--- vmstat.c	Thu Apr  9 19:28:35 1987
***************
*** 481,491 ****
  		, 2
  		, 1
  	);
! 	c = 0;
! 	for (i = 0; i < dk_ndrive && c < MAXDRIVES; i++)
! 		if (dk_select[i])
  			dinfo(i, ++c);
! 
  	putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 9);
  	putint(nchtotal.ncs_goodhits, NAMEIROW + 2, NAMEICOL + 9, 9);
  #define nz(x)	((x) ? (x) : 1)
--- 481,493 ----
  		, 2
  		, 1
  	);
! 	mvprintw(DISKROW,DISKCOL+5,"                              ");
! 	for (i = 0, c = 0; i < dk_ndrive && c < MAXDRIVES; i++)
! 		if (dk_select[i]) {
! 			mvprintw(DISKROW, DISKCOL + 5 + 5 * c,
! 				"  %3.3s", dr_name[i]);
  			dinfo(i, ++c);
! 		}
  	putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 9);
  	putint(nchtotal.ncs_goodhits, NAMEIROW + 2, NAMEICOL + 9, 9);
  #define nz(x)	((x) ? (x) : 1)