From 37ceff6b5c92a6383ec3d3334eb435a790a26abb Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 25 Jun 1996 15:20:08 +0000 Subject: distinguish ambigious and unknown commands; netbsd pr$2536; leo@marco.de --- usr.bin/systat/cmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c index 7531ced94b4..2225a059a8d 100644 --- a/usr.bin/systat/cmds.c +++ b/usr.bin/systat/cmds.c @@ -110,9 +110,7 @@ command(cmd) } 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); + error("%s: Ambiguous command.", cmd); goto done; } if (p) { @@ -142,6 +140,8 @@ command(cmd) status(); goto done; } + if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(cmd, cp)) + error("%s: Unknown command.", cmd); done: sigsetmask(omask); } @@ -170,7 +170,7 @@ lookup(name) nmatches++; } } - if (nmatches != 1) + if (nmatches > 1) return ((struct cmdtab *)-1); return (found); } -- cgit v1.2.3