Subject: bin/2536: bogus error message from systat (update for bin/2282)
To: None <gnats-bugs@NetBSD.ORG>
From: None <leo@marco.de>
List: netbsd-bugs
Date: 06/10/1996 13:23:00
>Number:         2536
>Category:       bin
>Synopsis:       bogus error message from systat (update for bin/2282)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 10 07:35:12 1996
>Last-Modified:
>Originator:     Matthias Pfaller
>Organization:
leo@dachau.marco.de			in real life: Matthias Pfaller
marco GmbH, 85221 Dachau, Germany	tel: +49 8131 516142
>Release:        960607
>Environment:
	
System: NetBSD klondike 1.2_ALPHA NetBSD 1.2_ALPHA (KLONDIKE) #3: Tue Jun 4 21:14:37 MET DST 1996 leo@klondike:/usr/src/sys/arch/pc532/compile/KLONDIKE pc532


>Description:
	While my original complain from bin/2282 (systat subcommands
	don't work) is fixed now, systat now says for *every* unknown
	command "Ambigous command" (And I still like my original fix
	better then the current one).

	The patch appended is an updated version of my patch in bin/2282.
	I was curious how this ever could have worked and looked at
	the original 4.4BSD-lite code. The 4.4BSD-lite code seems
	to have my patch applied ... :-) Does anyone know why this was
	changed at all?

>How-To-Repeat:
	systat
	:vmstat
	:blabla
>Fix:
*** cmds.c.ORIG	Sat May 11 14:17:17 1996
--- cmds.c	Sun Jun  9 00:42:46 1996
***************
*** 110,118 ****
          }
  	p = lookup(cmd);
  	if (p == (struct cmdtab *)-1) {
! 		/* if not a primary command, try a display specific one */
! 		if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(cmd, cp))
! 			error("%s: Ambiguous command.", cmd);
  		goto done;
  	}
          if (p) {
--- 110,116 ----
          }
  	p = lookup(cmd);
  	if (p == (struct cmdtab *)-1) {
! 		error("%s: Ambiguous command.", cmd);
  		goto done;
  	}
          if (p) {
***************
*** 142,147 ****
--- 140,147 ----
                  status();
  		goto done;
          }
+ 	if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(cmd, cp))
+ 		error("%s: Unknown command.", cmd);
  done:
  	sigsetmask(omask);
  }
***************
*** 170,176 ****
  				nmatches++;
  		}
  	}
! 	if (nmatches != 1)
  		return ((struct cmdtab *)-1);
  	return (found);
  }
--- 170,176 ----
  				nmatches++;
  		}
  	}
! 	if (nmatches > 1)
  		return ((struct cmdtab *)-1);
  	return (found);
  }
>Audit-Trail:
>Unformatted: