Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit make xxgdb and a gdb linked with libedit's readl...



details:   https://anonhg.NetBSD.org/src/rev/bae57fb46a1b
branches:  trunk
changeset: 495629:bae57fb46a1b
user:      chuck <chuck%NetBSD.org@localhost>
date:      Wed Aug 02 03:36:39 2000 +0000

description:
make xxgdb and a gdb linked with libedit's readline emulation work
properly together.   xxgdb communicates with a gdb running on a pty
that it sets to -echo,-onlcr prior to forking the gdb process.
GNU readline preserves the -echo setting while libedit was undoing it
(setting the tty to a sane state and totally confusing xxgdb's parser).

this diff simply disables libedit if both readline emulation and
"stty -echo" are used/set.   that is enough to make xxgdb work once
again, but (XXX) this is not how GNU readline handles stty -echo (it
does not echo anything, but editing commands like ^A,^K, etc.
still work), so the readline emulation isn't perfect.

change reviewed by christos.

diffstat:

 lib/libedit/el.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r f7dbdd46aa86 -r bae57fb46a1b lib/libedit/el.c
--- a/lib/libedit/el.c  Wed Aug 02 02:54:41 2000 +0000
+++ b/lib/libedit/el.c  Wed Aug 02 03:36:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: el.c,v 1.17 2000/06/28 20:37:44 sommerfeld Exp $       */
+/*     $NetBSD: el.c,v 1.18 2000/08/02 03:36:39 chuck 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.17 2000/06/28 20:37:44 sommerfeld Exp $");
+__RCSID("$NetBSD: el.c,v 1.18 2000/08/02 03:36:39 chuck Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -69,6 +69,8 @@
     const char *prog;
     FILE *fin, *fout, *ferr;
 {
+    extern char *rl_readline_name;
+
     EditLine *el = (EditLine *) el_malloc(sizeof(EditLine));
 #ifdef DEBUG
     char *tty;
@@ -88,6 +90,17 @@
      * Initialize all the modules. Order is important!!!
      */
     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);



Home | Main Index | Thread Index | Old Index