12-readline.c.patch [plain text]
--- export/src/readline.c 2006-08-29 21:11:07.000000000 +0200
+++ ../src/readline.c 2006-08-29 21:18:07.000000000 +0200
@@ -32,7 +32,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+/* AIX requires this to be the first thing in the file. */
+#if defined (_AIX) && !defined (__GNUC__)
+ #pragma alloca
+#endif
+
+#include <config.h>
+
+#ifdef __GNUC__
+# undef alloca
+# define alloca(n) __builtin_alloca (n)
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifndef _AIX
+extern char *alloca ();
+# endif
+# endif
+#endif
+
#if !defined(lint) && !defined(SCCSID)
__RCSID("$NetBSD: readline.c,v 1.69 2006/08/21 12:45:30 christos Exp $");
#endif /* not lint && not SCCSID */
@@ -49,18 +68,12 @@
#include <limits.h>
#include <errno.h>
#include <fcntl.h>
-#ifdef HAVE_VIS_H
#include <vis.h>
-#else
-#include "np/vis.h"
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
+
#include "el.h"
#include "fcns.h" /* for EL_NUM_FCNS */
#include "histedit.h"
-#include "readline/readline.h"
+#include "editline/readline.h"
#include "filecomplete.h"
void rl_prep_terminal(int);
@@ -191,7 +204,7 @@
return (HIST_ENTRY *) NULL;
rl_he.line = ev.str;
- rl_he.data = NULL;
+ rl_he.data = (histdata_t) &(ev.num);
return (&rl_he);
}
@@ -1427,8 +1440,7 @@
char *
username_completion_function(const char *text, int state)
{
- struct passwd *pwd, pwres;
- char pwbuf[1024];
+ struct passwd *pwd;
if (text[0] == '\0')
return (NULL);
@@ -1439,9 +1451,9 @@
if (state == 0)
setpwent();
- while (getpwent_r(&pwres, pwbuf, sizeof(pwbuf), &pwd) == 0
- && pwd != NULL && text[0] == pwd->pw_name[0]
- && strcmp(text, pwd->pw_name) == 0);
+ while ((pwd = getpwent())
+ && pwd != NULL && text[0] == pwd->pw_name[0]
+ && strcmp(text, pwd->pw_name) == 0);
if (pwd == NULL) {
endpwent();