From 4ab442a6ec52a9db30b04ed212514876b9330d2f Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Fri, 8 Jul 2005 01:07:55 +0000 Subject: [PATCH] bug 300025: Fix a couple of small bugs in editline. r+a=shaver --- js/src/editline/editline.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/src/editline/editline.c b/js/src/editline/editline.c index bf20b25f1fb..0f0210b39a1 100644 --- a/js/src/editline/editline.c +++ b/js/src/editline/editline.c @@ -255,7 +255,7 @@ TTYinfo() #if defined(USE_TERMCAP) char *term; char buff[2048]; - char *bp; + char *bp, *p; #endif /* defined(USE_TERMCAP) */ #if defined(TIOCGWINSZ) struct winsize W; @@ -284,7 +284,8 @@ TTYinfo() TTYrows = SCREEN_ROWS; return; } - backspace = strdup(tgetstr("le", &bp)); + p = tgetstr("le", &bp); + backspace = p ? strdup(p) : NULL; TTYwidth = tgetnum("co"); TTYrows = tgetnum("li"); #endif /* defined(USE_TERMCAP) */ @@ -1047,7 +1048,7 @@ add_history(p) return; #if defined(UNIQUE_HISTORY) - if (H.Pos && strcmp(p, H.Lines[H.Pos - 1]) == 0) + if (H.Size && strcmp(p, H.Lines[H.Size - 1]) == 0) return; #endif /* defined(UNIQUE_HISTORY) */ hist_add((CHAR *)p);