120 lines
3.3 KiB
Text
120 lines
3.3 KiB
Text
$NetBSD: patch-an,v 1.3 2006/05/15 15:33:00 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++)
|
|
{
|