summaryrefslogtreecommitdiffstats
path: root/sys/ddb
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-11-20 16:53:23 +0000
committerbde <bde@FreeBSD.org>1997-11-20 16:53:23 +0000
commit7cd32186dac35285502c6e2136fcbf68f6c3d03f (patch)
treee77a8f49829d29e03cf0453554a9f37d50d026a4 /sys/ddb
parentf1a47dd32b7d306224167d64c3080fe11a8a2703 (diff)
downloadFreeBSD-src-7cd32186dac35285502c6e2136fcbf68f6c3d03f.zip
FreeBSD-src-7cd32186dac35285502c6e2136fcbf68f6c3d03f.tar.gz
Cleaned up revs.1.19-1.21:
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_input.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c
index d055263..453052a 100644
--- a/sys/ddb/db_input.c
+++ b/sys/ddb/db_input.c
@@ -23,7 +23,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: db_input.c,v 1.20 1997/11/07 02:34:50 msmith Exp $
+ * $Id: db_input.c,v 1.21 1997/11/09 06:30:29 msmith Exp $
*/
/*
@@ -57,8 +57,7 @@ static char * db_le; /* one past last character */
/*
* Simple input line history support.
*/
-static char * db_lhistory;
-static char db_lhistory_buffer[2048];
+static char db_lhistory[2048];
static int db_lhistlsize, db_lhistidx, db_lhistcur;
static int db_lhist_nlines;
@@ -160,7 +159,7 @@ db_inputchar(c)
escstate = 1;
break;
#if __i386__ && __FreeBSD__
- case 591: /* syscons's idea of an arrow key... */
+ case 591: /* syscons's idea of left arrow key */
#endif
case CTRL('b'):
/* back up one character */
@@ -170,7 +169,7 @@ db_inputchar(c)
}
break;
#if __i386__ && __FreeBSD__
- case 593: /* syscons's idea of an arrow key... */
+ case 593: /* syscons's idea of right arrow key */
#endif
case CTRL('f'):
/* forward one character */
@@ -230,7 +229,7 @@ db_inputchar(c)
}
break;
#if __i386__ && __FreeBSD__
- case 588: /* syscons's idea of an arrow key... */
+ case 588: /* syscons's idea of up arrow key */
#endif
case CTRL('p'):
/* Make previous history line the active one. */
@@ -242,7 +241,7 @@ db_inputchar(c)
}
break;
#if __i386__ && __FreeBSD__
- case 596: /* syscons's idea of an arrow key... */
+ case 596: /* syscons's idea of down arrow key */
#endif
case CTRL('n'):
/* Make next history line the active one. */
@@ -311,14 +310,12 @@ db_readline(lstart, lsize)
char * lstart;
int lsize;
{
- if (db_lhistory && lsize != db_lhistlsize) {
- /* Should not happen, but to be sane, throw history away. */
- db_lhistory = NULL;
- }
- if (db_lhistory == NULL) {
- /* Initialize input line history. */
- db_lhistory = db_lhistory_buffer;
- db_lhist_nlines = (sizeof db_lhistory_buffer) / lsize;
+ if (lsize != db_lhistlsize) {
+ /*
+ * (Re)initialize input line history. Throw away any
+ * existing history.
+ */
+ db_lhist_nlines = sizeof(db_lhistory) / lsize;
db_lhistlsize = lsize;
db_lhistidx = -1;
}
@@ -337,7 +334,7 @@ db_readline(lstart, lsize)
db_printf("\n"); /* synch output position */
*db_le = 0;
- if (db_lhistory && (db_le - db_lbuf_start > 1)) {
+ if (db_le - db_lbuf_start > 1) {
/* Maintain input line history for non-empty lines. */
if (++db_lhistidx == db_lhist_nlines) {
/* Rotate history. */
@@ -345,7 +342,7 @@ db_readline(lstart, lsize)
db_lhistlsize * (db_lhist_nlines - 1));
db_lhistidx--;
}
- bcopy(lstart, db_lhistory + (db_lhistidx * db_lhistlsize),
+ bcopy(lstart, db_lhistory + db_lhistidx * db_lhistlsize,
db_lhistlsize);
}
OpenPOWER on IntegriCloud