"Initial commit to Gerrit"
[profile/ivi/libedit.git] / packaging / 04-readline.c.patch
1 --- export/src/readline.c       2009-09-23 22:55:51.000000000 +0200
2 +++ ../src/readline.c   2009-09-23 23:04:26.000000000 +0200
3 @@ -29,7 +29,8 @@
4   * POSSIBILITY OF SUCH DAMAGE.
5   */
6  
7 -#include "config.h"
8 +#include <config.h>
9 +
10  #if !defined(lint) && !defined(SCCSID)
11  __RCSID("$NetBSD: readline.c,v 1.85 2009/09/07 21:24:33 christos Exp $");
12  #endif /* not lint && not SCCSID */
13 @@ -47,17 +48,17 @@
14  #include <errno.h>
15  #include <fcntl.h>
16  #include <setjmp.h>
17 -#ifdef HAVE_VIS_H
18  #include <vis.h>
19 -#else
20 -#include "np/vis.h"
21 -#endif
22 -#include "readline/readline.h"
23 +#include "editline/readline.h"
24  #include "el.h"
25  #include "fcns.h"              /* for EL_NUM_FCNS */
26  #include "histedit.h"
27  #include "filecomplete.h"
28  
29 +#if !defined(SIZE_T_MAX)
30 +# define SIZE_T_MAX (size_t)(-1) 
31 +#endif
32 +
33  void rl_prep_terminal(int);
34  void rl_deprep_terminal(void);
35  
36 @@ -194,7 +195,7 @@
37                 return (HIST_ENTRY *) NULL;
38  
39         rl_he.line = ev.str;
40 -       rl_he.data = NULL;
41 +       rl_he.data = (histdata_t) &(ev.num);
42  
43         return (&rl_he);
44  }
45 @@ -1665,8 +1666,7 @@
46  char *
47  username_completion_function(const char *text, int state)
48  {
49 -       struct passwd *pwd, pwres;
50 -       char pwbuf[1024];
51 +       struct passwd *pwd;
52  
53         if (text[0] == '\0')
54                 return (NULL);
55 @@ -1677,9 +1677,9 @@
56         if (state == 0)
57                 setpwent();
58  
59 -       while (getpwent_r(&pwres, pwbuf, sizeof(pwbuf), &pwd) == 0
60 -           && pwd != NULL && text[0] == pwd->pw_name[0]
61 -           && strcmp(text, pwd->pw_name) == 0);
62 +   while ((pwd = getpwent())
63 +               && pwd != NULL && text[0] == pwd->pw_name[0]
64 +               && strcmp(text, pwd->pw_name) == 0);
65  
66         if (pwd == NULL) {
67                 endpwent();