summaryrefslogtreecommitdiffstats
path: root/usr.bin/more
diff options
context:
space:
mode:
authorhoek <hoek@FreeBSD.org>2000-01-08 18:11:05 +0000
committerhoek <hoek@FreeBSD.org>2000-01-08 18:11:05 +0000
commit915166be12382c1b91deee4458f84af9c7409865 (patch)
treede7cd163c3cc8e3d6fe4e50498df20afcf8b7fd0 /usr.bin/more
parent8148de2437ba0520f708210dfb766377a11a04d4 (diff)
downloadFreeBSD-src-915166be12382c1b91deee4458f84af9c7409865.zip
FreeBSD-src-915166be12382c1b91deee4458f84af9c7409865.tar.gz
Correctly backspace over number N that preceeds macros.
Diffstat (limited to 'usr.bin/more')
-rw-r--r--usr.bin/more/command.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/more/command.c b/usr.bin/more/command.c
index 1e7c988..646ffe6 100644
--- a/usr.bin/more/command.c
+++ b/usr.bin/more/command.c
@@ -149,9 +149,8 @@ cmd_char(c, bufbeg, bufcur, bufend)
int c; /* The character to process */
char *bufbeg; /* The buffer to add the character to */
char **bufcur; /* The position at which to add the character */
- char *bufend; /* The last spot available in the buffer --- remember
- * to leave one after bufend for the '\0'! (You must
- * add the '\0' yourself!!) */
+ char *bufend; /* One after the last address available in the buffer.
+ * No character will be placed into *bufend. */
{
if (c == erase_char)
return(cmd_erase(bufbeg, bufcur));
@@ -583,8 +582,11 @@ commands()
continue; /* process the sigs */
}
- if (Nstate == GETTING && !isdigit(c)) {
- /* mark the end of an input number N, if any */
+ if (Nstate == GETTING && !isdigit(c)
+ && c != erase_char && c != werase_char && c != kill_char) {
+ /*
+ * Mark the end of an input number N, if any.
+ */
if (!*inbuf) {
/* We never actually got an input number */
@@ -596,9 +598,12 @@ commands()
*inbuf = '\0';
incur = inbuf;
}
- cmd_char(c, inbuf, &incur, inbuf + sizeof(inbuf) - 1);
+ (void) cmd_char(c, inbuf, &incur, inbuf + sizeof(inbuf) - 1);
*incur = '\0';
- if (*inbuf) prmpt(inbuf);
+ if (*inbuf)
+ prmpt(inbuf);
+ else
+ Nstate = GETTING; /* abort command */
if (Nstate == GETTING) {
/* Still reading in the number N ... don't want to
OpenPOWER on IntegriCloud