From 5af2964703b77c9e6a806b3b54bd98856d5f6840 Mon Sep 17 00:00:00 2001 From: dsl Date: Sat, 26 Feb 2005 19:01:09 +0000 Subject: [PATCH] Always treat ^h and ^? as erase chars (as well as stty erase). Make the ':' erasable. Fix typo in unviewable help message. No point in having 'else' after 'return'... --- usr.bin/systat/cmdtab.c | 6 +++--- usr.bin/systat/globalcmds.c | 17 ++++++++++------- usr.bin/systat/keyboard.c | 11 +++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/usr.bin/systat/cmdtab.c b/usr.bin/systat/cmdtab.c index 68c55c9f9293..e6b3488e391a 100644 --- a/usr.bin/systat/cmdtab.c +++ b/usr.bin/systat/cmdtab.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdtab.c,v 1.20 2005/02/16 03:45:41 hubertf Exp $ */ +/* $NetBSD: cmdtab.c,v 1.21 2005/02/26 19:01:09 dsl Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: cmdtab.c,v 1.20 2005/02/16 03:45:41 hubertf Exp $"); +__RCSID("$NetBSD: cmdtab.c,v 1.21 2005/02/26 19:01:09 dsl Exp $"); #endif /* not lint */ #include "systat.h" @@ -74,7 +74,7 @@ struct command iostat_commands[] = { { "numbers", iostat_numbers, "show io stats numerically"}, { "secs", iostat_secs, "include time statistics"}, { "rw", iostat_rw, "show read/write disk stats"}, - { "all", iostat_all, "show combiend disk stats"}, + { "all", iostat_all, "show combined disk stats"}, /* from disks.c */ { "display", disks_add, "add a disk to displayed disks"}, { "ignore", disks_remove, "remove a disk from displayed disks"}, diff --git a/usr.bin/systat/globalcmds.c b/usr.bin/systat/globalcmds.c index da62f47467fc..10d7938a1341 100644 --- a/usr.bin/systat/globalcmds.c +++ b/usr.bin/systat/globalcmds.c @@ -1,4 +1,4 @@ -/* $NetBSD: globalcmds.c,v 1.11 2004/07/03 18:54:47 mycroft Exp $ */ +/* $NetBSD: globalcmds.c,v 1.12 2005/02/26 19:01:09 dsl Exp $ */ /*- * Copyright (c) 1999 @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: globalcmds.c,v 1.11 2004/07/03 18:54:47 mycroft Exp $"); +__RCSID("$NetBSD: globalcmds.c,v 1.12 2005/02/26 19:01:09 dsl Exp $"); #endif /* not lint */ #include @@ -51,7 +51,7 @@ static char * shortname(const char *key, const char *s) { char *p, *q; - size_t l; + size_t len; if (key == NULL) { if ((p = strdup(s)) == NULL) @@ -62,13 +62,16 @@ shortname(const char *key, const char *s) q[2] = '\0'; } return p; - } else if (strncmp(key, s, l = strlen(key)) == 0 && s[l] == '.') { - p = strdup(s + l + 1); + } + + len = strlen(key); + if (strncmp(key, s, len) == 0 && s[len] == '.') { + p = strdup(s + len + 1); if (!p) return NULL; return p; - } else - return NULL; + } + return NULL; } void diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c index ddeb99196456..b25f8159dd37 100644 --- a/usr.bin/systat/keyboard.c +++ b/usr.bin/systat/keyboard.c @@ -1,4 +1,4 @@ -/* $NetBSD: keyboard.c,v 1.20 2004/11/04 07:18:47 dsl Exp $ */ +/* $NetBSD: keyboard.c,v 1.21 2005/02/26 19:01:09 dsl Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: keyboard.c,v 1.20 2004/11/04 07:18:47 dsl Exp $"); +__RCSID("$NetBSD: keyboard.c,v 1.21 2005/02/26 19:01:09 dsl Exp $"); #endif /* not lint */ #include @@ -109,10 +109,9 @@ keyboard(void) } continue; } - if (ch == erasechar() && col > 0) { - if (col == 1) - continue; - col--; + if (ch == '\b' || ch == '\?' || ch == erasechar()) { + if (col > 0) + col--; goto doerase; } if (ch == CTRL('w') && col > 0) {