Module Name:    src
Committed By:   christos
Date:           Sat Jun  9 17:41:55 UTC 2018

Modified Files:
        src/lib/libedit: readline.c
        src/lib/libedit/readline: readline.h

Log Message:
Provide more compatibility with readline headers; now python-3.6.5 works
when changing 'readline' -> 'edit' in setup.py.
Revert previous conditional setting of unbuffered.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/lib/libedit/readline.c
cvs rdiff -u -r1.42 -r1.43 src/lib/libedit/readline/readline.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.146 src/lib/libedit/readline.c:1.147
--- src/lib/libedit/readline.c:1.146	Mon Jan  1 17:32:46 2018
+++ src/lib/libedit/readline.c	Sat Jun  9 13:41:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.147 2018/06/09 17:41:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.147 2018/06/09 17:41:55 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -80,7 +80,7 @@ int rl_end = 0;
 char *rl_line_buffer = NULL;
 rl_vcpfunc_t *rl_linefunc = NULL;
 int rl_done = 0;
-VFunction *rl_event_hook = NULL;
+rl_hook_func_t *rl_event_hook = NULL;
 KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
     emacs_meta_keymap,
     emacs_ctlx_keymap;
@@ -429,7 +429,7 @@ readline(const char *p)
 	if (rl_pre_input_hook)
 		(*rl_pre_input_hook)(NULL, 0);
 
-	if (rl_event_hook && !(e->el_flags&NO_TTY)) {
+	if (rl_event_hook && !(e->el_flags & NO_TTY)) {
 		el_set(e, EL_GETCFN, _rl_event_read_char);
 		used_event_hook = 1;
 	}
@@ -2074,15 +2074,12 @@ rl_callback_read_char(void)
 	if (done && rl_linefunc != NULL) {
 		el_set(e, EL_UNBUFFERED, 0);
 		if (done == 2) {
-		    if ((wbuf = strdup(buf)) != NULL)
-			wbuf[count] = '\0';
+			if ((wbuf = strdup(buf)) != NULL)
+				wbuf[count] = '\0';
 		} else
 			wbuf = NULL;
 		(*(void (*)(const char *))rl_linefunc)(wbuf);
-		if (!rl_already_prompted) {
-		    el_set(e, EL_UNBUFFERED, 1);
-		    rl_already_prompted = 1;
-		}
+		el_set(e, EL_UNBUFFERED, 1);
 	}
 }
 

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.42 src/lib/libedit/readline/readline.h:1.43
--- src/lib/libedit/readline/readline.h:1.42	Fri Sep  1 06:19:10 2017
+++ src/lib/libedit/readline/readline.h	Sat Jun  9 13:41:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.42 2017/09/01 10:19:10 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.43 2018/06/09 17:41:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,11 +38,13 @@
 
 /* typedefs */
 typedef int	  Function(const char *, int);
+typedef char     *CPFunction(const char *, int);
 typedef void	  VFunction(void);
 typedef void	  rl_vcpfunc_t(char *);
 typedef char	**rl_completion_func_t(const char *, int, int);
 typedef char     *rl_compentry_func_t(const char *, int);
 typedef int	  rl_command_func_t(int, int);
+typedef int	  rl_hook_func_t(void);
 
 /* only supports length */
 typedef struct {
@@ -137,6 +139,7 @@ extern VFunction	*rl_redisplay_function;
 extern VFunction	*rl_completion_display_matches_hook;
 extern VFunction	*rl_prep_term_function;
 extern VFunction	*rl_deprep_term_function;
+extern rl_hook_func_t	*rl_event_hook;
 extern int		readline_echoing_p;
 extern int		_rl_print_completions_horizontally;
 
@@ -177,7 +180,7 @@ char		*filename_completion_function(cons
 char		*username_completion_function(const char *, int);
 int		 rl_complete(int, int);
 int		 rl_read_key(void);
-char	       **completion_matches(const char *, rl_compentry_func_t *);
+char	       **completion_matches(/* const */ char *, rl_compentry_func_t *);
 void		 rl_display_match_list(char **, int, int);
 
 int		 rl_insert(int, int);

Reply via email to