From 304ebe4875957077fdfeac4b006c4cc638508b09 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 5 Jan 2001 22:45:30 +0000 Subject: [PATCH] depoison the pure editline code from readline compatibility hacks. --- lib/libedit/el.c | 14 ++------------ lib/libedit/readline.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/libedit/el.c b/lib/libedit/el.c index a7487fc07dd2..aeb9567b24ea 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -1,4 +1,4 @@ -/* $NetBSD: el.c,v 1.20 2000/11/11 22:18:57 christos Exp $ */ +/* $NetBSD: el.c,v 1.21 2001/01/05 22:45:30 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94"; #else -__RCSID("$NetBSD: el.c,v 1.20 2000/11/11 22:18:57 christos Exp $"); +__RCSID("$NetBSD: el.c,v 1.21 2001/01/05 22:45:30 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -63,7 +63,6 @@ __RCSID("$NetBSD: el.c,v 1.20 2000/11/11 22:18:57 christos Exp $"); public EditLine * el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr) { - extern char *rl_readline_name; EditLine *el = (EditLine *) el_malloc(sizeof(EditLine)); #ifdef DEBUG @@ -85,15 +84,6 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr) */ el->el_flags = 0; - /* readline compat hack to make xxgdb work */ - if (prog == rl_readline_name) { - struct termios t; - - if (tcgetattr(el->el_infd, &t) == 0) { - if ((t.c_lflag & ECHO) == 0) - el->el_flags |= EDIT_DISABLED; - } - } (void) term_init(el); (void) key_init(el); (void) map_init(el); diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index 150c074fa846..aad6d3136c5b 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.17 2001/01/05 21:15:49 jdolecek Exp $ */ +/* $NetBSD: readline.c,v 1.18 2001/01/05 22:45:30 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.17 2001/01/05 21:15:49 jdolecek Exp $"); +__RCSID("$NetBSD: readline.c,v 1.18 2001/01/05 22:45:30 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -181,6 +181,8 @@ rl_initialize(void) HistEvent ev; const LineInfo *li; int i; + int editmode = 1; + struct termios t; if (e != NULL) el_end(e); @@ -191,8 +193,18 @@ rl_initialize(void) rl_instream = stdin; if (!rl_outstream) rl_outstream = stdout; + + /* + * See if we don't really want to run the editor + */ + if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & ECHO) == 0) + editmode = 0; + e = el_init(rl_readline_name, rl_instream, rl_outstream, stderr); + if (!editmode) + el_set(e, EL_EDITMODE, 0); + h = history_init(); if (!e || !h) return (-1);