--- export/src/readline.c 2007-03-02 22:26:59.000000000 +0100 +++ ../src/readline.c 2007-03-02 22:38:45.000000000 +0100 @@ -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 + +#ifdef __GNUC__ +# undef alloca +# define alloca(n) __builtin_alloca (n) +#else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifndef _AIX +extern char *alloca (); +# endif +# endif +#endif + #if !defined(lint) && !defined(SCCSID) __RCSID("$NetBSD: readline.c,v 1.70 2006/11/24 00:01:17 christos Exp $"); #endif /* not lint && not SCCSID */ @@ -50,18 +69,11 @@ #include #include #include -#ifdef HAVE_VIS_H #include -#else -#include "np/vis.h" -#endif -#ifdef HAVE_ALLOCA_H -#include -#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); @@ -198,7 +210,7 @@ return (HIST_ENTRY *) NULL; rl_he.line = ev.str; - rl_he.data = NULL; + rl_he.data = (histdata_t) &(ev.num); return (&rl_he); } @@ -1437,8 +1449,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); @@ -1449,9 +1460,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();