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'...
This commit is contained in:
dsl 2005-02-26 19:01:09 +00:00
parent 4583d5361a
commit 5af2964703
3 changed files with 18 additions and 16 deletions

View File

@ -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"},

View File

@ -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 <sys/cdefs.h>
#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 <curses.h>
@ -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

View File

@ -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 <sys/types.h>
@ -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) {