aboutsummaryrefslogtreecommitdiff
path: root/lib/libedit/hist.h
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-01-09 07:40:56 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-01-09 07:40:56 +0000
commitc1a66a97f95d2f4366348b75e2c7676d11048666 (patch)
treed33ef1b987208879e7fa795c6b8d9fb885b151a9 /lib/libedit/hist.h
parentec680ff8a8ad7b7018eaf69ad934178e6464e61e (diff)
downloadsrc-c1a66a97f95d2f4366348b75e2c7676d11048666.tar.gz
src-c1a66a97f95d2f4366348b75e2c7676d11048666.zip
Synchronize libedit with NetBSD and activate UTF-8 support [1]
Differences with NetBSD Reapply our local patches on top of it Fix Unicode environement detection Fix reading a line in unicode environment. It allows /bin/sh to works in UTF-8 envs Differential Revision: https://reviews.freebsd.org/D1455 Reviewed by: jilles, pfg Obtained from: NetBSD [1] MFC after: 1 month Relnotes: yes
Notes
Notes: svn path=/head/; revision=276881
Diffstat (limited to 'lib/libedit/hist.h')
-rw-r--r--lib/libedit/hist.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h
index 4ddedcc59b3d..1cd7d9df397f 100644
--- a/lib/libedit/hist.h
+++ b/lib/libedit/hist.h
@@ -1,3 +1,5 @@
+/* $NetBSD: hist.h,v 1.14 2014/05/11 01:05:17 christos Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -30,7 +32,6 @@
* SUCH DAMAGE.
*
* @(#)hist.h 8.1 (Berkeley) 6/4/93
- * $NetBSD: hist.h,v 1.10 2003/08/07 16:44:31 agc Exp $
* $FreeBSD$
*/
@@ -42,21 +43,29 @@
#include "histedit.h"
-typedef int (*hist_fun_t)(ptr_t, HistEvent *, int, ...);
+typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...);
typedef struct el_history_t {
- char *buf; /* The history buffer */
+ Char *buf; /* The history buffer */
size_t sz; /* Size of history buffer */
- char *last; /* The last character */
+ Char *last; /* The last character */
int eventno; /* Event we are looking for */
- ptr_t ref; /* Argument for history fcns */
+ void * ref; /* Argument for history fcns */
hist_fun_t fun; /* Event access */
- HistEvent ev; /* Event cookie */
+ TYPE(HistEvent) ev; /* Event cookie */
} el_history_t;
-#define HIST_FUN(el, fn, arg) \
+#define HIST_FUN_INTERNAL(el, fn, arg) \
((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \
fn, arg)) == -1) ? NULL : (el)->el_history.ev.str)
+#ifdef WIDECHAR
+#define HIST_FUN(el, fn, arg) \
+ (((el)->el_flags & NARROW_HISTORY) ? hist_convert(el, fn, arg) : \
+ HIST_FUN_INTERNAL(el, fn, arg))
+#else
+#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg)
+#endif
+
#define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL)
#define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL)
@@ -70,8 +79,11 @@ typedef struct el_history_t {
protected int hist_init(EditLine *);
protected void hist_end(EditLine *);
protected el_action_t hist_get(EditLine *);
-protected int hist_set(EditLine *, hist_fun_t, ptr_t);
-protected int hist_command(EditLine *, int, const char **);
+protected int hist_set(EditLine *, hist_fun_t, void *);
+protected int hist_command(EditLine *, int, const Char **);
protected int hist_enlargebuf(EditLine *, size_t, size_t);
+#ifdef WIDECHAR
+protected wchar_t *hist_convert(EditLine *, int, void *);
+#endif
#endif /* _h_el_hist */