1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
$NetBSD: patch-an,v 1.4 2008/12/17 02:19:59 christos Exp $
$NetBSD: patch-an,v 1.4 2008/12/17 02:19:59 christos Exp $
--- readline/readline.c.orig 1995-02-24 16:20:03.000000000 -0500
+++ readline/readline.c 2006-05-15 10:41:51.000000000 -0400
@@ -43,12 +43,18 @@
#include <fcntl.h>
#include <sys/file.h>
#include <signal.h>
+#include <stdlib.h>
+#include <readline/readline.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
+#if !defined(__linux__)
#define NEW_TTY_DRIVER
+#else
+#define TERMIOS_TTY_DRIVER
+#endif
#define HAVE_BSD_SIGNALS
/* #define USE_XON_XOFF */
@@ -80,6 +86,10 @@
# if !defined (O_NDELAY)
# define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
# endif /* O_NDELAY */
+#else
+# ifdef TERMIOS_TTY_DRIVER
+# include <termios.h>
+# endif /* !TERMIOS_MISSING */
#endif /* _POSIX_VERSION */
/* Other (BSD) machines use sgtty. */
@@ -104,7 +114,6 @@
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
#include <errno.h>
-extern int errno;
#include <setjmp.h>
#if defined (SHELL)
@@ -133,7 +142,7 @@
# endif /* USGr3 */
#endif /* USG && hpux */
-#if defined (_POSIX_VERSION) || defined (USGr3)
+#if defined (_POSIX_VERSION) || defined (USGr3) || defined(__linux__)
# include <dirent.h>
# define direct dirent
# if defined (_POSIX_VERSION)
@@ -280,7 +289,7 @@
static FILE *in_stream, *out_stream;
/* The names of the streams that we do input and output to. */
-FILE *rl_instream = stdin, *rl_outstream = stdout;
+FILE *rl_instream = NULL, *rl_outstream = NULL;
/* Non-zero means echo characters as they are read. */
int readline_echoing_p = 1;
@@ -1152,6 +1161,8 @@
{
/* Find out if we are running in Emacs. */
running_in_emacs = getenv ("EMACS");
+ rl_instream = stdin;
+ rl_outstream = stdout;
/* Allocate data structures. */
if (!rl_line_buffer)
@@ -2505,7 +2516,11 @@
tio.c_lflag &= ~(ICANON | ECHO);
- if (otio.c_cc[VEOF] != _POSIX_VDISABLE)
+#ifdef ONLCR
+ tio.c_oflag |= OPOST|ONLCR;
+#endif
+
+ if ((unsigned char)otio.c_cc[VEOF] != (unsigned char)_POSIX_VDISABLE)
eof_char = otio.c_cc[VEOF];
#if defined (USE_XON_XOFF)
@@ -2637,7 +2652,7 @@
return (1);
if (allow_pathname_alphabetic_chars)
- return ((int)rindex (pathname_alphabetic_chars, c));
+ return (rindex (pathname_alphabetic_chars, c) != NULL);
else
return (0);
}
@@ -3570,7 +3585,7 @@
If this function exists and returns NULL then call the value of
rl_completion_entry_function to try to match, otherwise use the
array of strings returned. */
-Function *rl_attempted_completion_function = (Function *)NULL;
+CPPFunction *rl_attempted_completion_function = (CPPFunction *)NULL;
/* Local variable states what happened during the last completion attempt. */
static int completion_changed_buffer = 0;
@@ -3706,8 +3721,7 @@
variable rl_attempted_completion_function. */
if (rl_attempted_completion_function)
{
- matches =
- (char **)(*rl_attempted_completion_function) (text, start, end);
+ matches = (*rl_attempted_completion_function) (text, start, end);
if (matches)
{
@@ -3760,8 +3774,7 @@
/* We have marked all the dead slots with (char *)-1.
Copy all the non-dead entries into a new array. */
{
- char **temp_array =
- (char **)malloc ((3 + newlen) * sizeof (char *));
+ char **temp_array = malloc ((3 + newlen) * sizeof (char *));
for (i = 1, j = 1; matches[i]; i++)
{
|