aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTim Vanderhoek <hoek@FreeBSD.org>2000-01-08 18:11:05 +0000
committerTim Vanderhoek <hoek@FreeBSD.org>2000-01-08 18:11:05 +0000
commitbc2f9c0fa6ef948f4f463c83047106b2dfa303bf (patch)
treeafdf25430118722311c76de1a8bd60f829a27c97 /usr.bin
parenta052e7173ce4fc7695b02d0e261f356eebaadcc6 (diff)
downloadsrc-bc2f9c0fa6ef948f4f463c83047106b2dfa303bf.tar.gz
src-bc2f9c0fa6ef948f4f463c83047106b2dfa303bf.zip
Correctly backspace over number N that preceeds macros.
Notes
Notes: svn path=/head/; revision=55620
Diffstat (limited to 'usr.bin')
-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 1e7c9885c580..646ffe6e264e 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