Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit depoison the pure editline code from readline co...



details:   https://anonhg.NetBSD.org/src/rev/d1d8bbdbe108
branches:  trunk
changeset: 501701:d1d8bbdbe108
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 05 22:45:30 2001 +0000

description:
depoison the pure editline code from readline compatibility hacks.

diffstat:

 lib/libedit/el.c       |  14 ++------------
 lib/libedit/readline.c |  16 ++++++++++++++--
 2 files changed, 16 insertions(+), 14 deletions(-)

diffs (88 lines):

diff -r 8e1eb44fc284 -r d1d8bbdbe108 lib/libedit/el.c
--- a/lib/libedit/el.c  Fri Jan 05 22:29:28 2001 +0000
+++ b/lib/libedit/el.c  Fri Jan 05 22:45:30 2001 +0000
@@ -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 @@
 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->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 -r 8e1eb44fc284 -r d1d8bbdbe108 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Fri Jan 05 22:29:28 2001 +0000
+++ b/lib/libedit/readline.c    Fri Jan 05 22:45:30 2001 +0000
@@ -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 <sys/cdefs.h>
 #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 <sys/types.h>
@@ -181,6 +181,8 @@
        HistEvent ev;
        const LineInfo *li;
        int i;
+       int editmode = 1;
+       struct termios t;
 
        if (e != NULL)
                el_end(e);
@@ -191,8 +193,18 @@
                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);



Home | Main Index | Thread Index | Old Index