This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

readline maintainer


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The patch below is needed if bash is to dynamically link against readline.
  It adds the same hack I used in the static link to work around the
double-character prompt printing bug (the bug has been reported upstream,
but no official answer has been made).  It also adds an additional hook so
that bash can override getenv(), fixing not only tilde-expansion, but
several other environment variables that readline tries to read.

Charles, since readline and bash are so intricately related (and have the
same upstream maintainer), would you be willing to relinquish
maintainership of the various readline packages to me?  I've never
packaged anything with a .dll before, but hopefully I can learn it quickly
from the existing setup.

2005-07-20  Eric Blake  <ebb9@byu.net>

	* display.c (expand_prompt): Hack for double-printing bug.
	* readline.h (rl_getenv_hook): New export.
	* rltypedefs.h (rl_getenv_func_t): New typedef.
	* shell.c (sh_get_env_value): Use new hook, so that bash can
	provide access an alternate environment.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC3k6384KuGfSFAYARAqeeAKDBG6v1wOzHjnjKwXw5nThARO8jywCgih9H
5ikfrQQrutAcM1cd5K4lH8s=
=hist
-----END PGP SIGNATURE-----
diff -ubr readline-5.0.bak/display.c readline-5.0/display.c
--- readline-5.0.bak/display.c	2005-07-19 06:26:16.187375000 -0600
+++ readline-5.0/display.c	2005-07-20 06:57:52.656125000 -0600
@@ -286,7 +286,10 @@
   if (lp)
     *lp = rl;
   if (lip)
-    *lip = last;
+    /* Hack: faking that \[\] was always the last part of the prompt reduces
+       (but does not completely solve) double character prompt display bugs. */
+    *lip = r - ret;
+/*    *lip = last; */
   if (niflp)
     *niflp = invfl;
   if  (vlp)
diff -ubr readline-5.0.bak/readline.h readline-5.0/readline.h
--- readline-5.0.bak/readline.h	2005-07-19 06:26:27.609250000 -0600
+++ readline-5.0/readline.h	2005-07-19 20:48:48.234250000 -0600
@@ -829,6 +829,9 @@
 extern int rl_save_state PARAMS((struct readline_state *));
 extern int rl_restore_state PARAMS((struct readline_state *));
 
+/* If non-null, the address of a replacement to getenv.  */
+extern rl_getenv_func_t *rl_getenv_hook;
+
 #ifdef __cplusplus
 }
 #endif
diff -ubr readline-5.0.bak/rltypedefs.h readline-5.0/rltypedefs.h
--- readline-5.0.bak/rltypedefs.h	2005-07-19 06:26:28.640500000 -0600
+++ readline-5.0/rltypedefs.h	2005-07-19 20:49:06.484250000 -0600
@@ -85,6 +85,8 @@
 typedef char *rl_cpcpfunc_t PARAMS((char  *));
 typedef char *rl_cpcppfunc_t PARAMS((char  **));
 
+typedef char *rl_getenv_func_t PARAMS((const char *));
+
 #endif /* _RL_FUNCTION_TYPEDEF */
 
 #ifdef __cplusplus
diff -ubr readline-5.0.bak/shell.c readline-5.0/shell.c
--- readline-5.0.bak/shell.c	2005-07-19 06:26:28.828000000 -0600
+++ readline-5.0/shell.c	2005-07-19 20:50:12.374875000 -0600
@@ -53,6 +53,7 @@
 
 #include <stdio.h>
 
+#include "readline.h"
 #include "rlstdc.h"
 #include "rlshell.h"
 #include "xmalloc.h"
@@ -81,6 +82,8 @@
   ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
    + 1 + TYPE_SIGNED (t))
 
+rl_getenv_func_t *rl_getenv_hook = (rl_getenv_func_t *)NULL;
+
 /* All of these functions are resolved from bash if we are linking readline
    as part of bash. */
 
@@ -149,6 +152,8 @@
 sh_get_env_value (varname)
      const char *varname;
 {
+  if (rl_getenv_hook)
+    return (rl_getenv_hook) (varname);
   return ((char *)getenv (varname));
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]