summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2001-10-09 13:50:29 +0000
committerchristos <christos@NetBSD.org>2001-10-09 13:50:29 +0000
commit545f12e0c59ac3a29ca0d0a5d0edbfbfe33a2a3d (patch)
tree4bee485469865fd1165ae0f31dc1f70a638ebdcf /lib/libedit
parent76e9d7eb1252132e9e433162365bdcf156a3387b (diff)
PR/14188: Anthony Mallet: Provide an opaque data pointer to client programs.
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/editline.315
-rw-r--r--lib/libedit/el.c13
-rw-r--r--lib/libedit/el.h3
-rw-r--r--lib/libedit/histedit.h3
-rw-r--r--lib/libedit/shlib_version4
5 files changed, 31 insertions, 7 deletions
diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3
index ccc1288639b..5acb61b9700 100644
--- a/lib/libedit/editline.3
+++ b/lib/libedit/editline.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: editline.3,v 1.23 2001/10/04 00:45:19 lukem Exp $
+.\" $NetBSD: editline.3,v 1.24 2001/10/09 13:50:29 christos Exp $
.\"
.\" Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -379,6 +379,13 @@ and
.Fn el_getc .
The builtin function can be set or restored with the special function
name ``EL_BUILTIN_GETCFN''.
+.It Dv EL_CLIENTDATA , Fa "void *data"
+Register
+.Fa data
+to be associated with this EditLine structure. It can be retrieved with
+the corresponding
+.Fn el_get
+call.
.El
.It Fn el_get
Get
@@ -413,6 +420,12 @@ Return non-zero if editing is enabled.
.It Dv EL_GETCFN, Fa "int (**f)(EditLine *, char *)"
Return a pointer to the function that read characters, which is equal to
``EL_BUILTIN_GETCFN'' in the case of the default builtin function.
+.It Dv EL_CLIENTDATA , Fa "void **data"
+Retrieve
+.Fa data
+previously registered with the corresponding
+.Fn el_set
+call.
.El
.It Fn el_source
Initialise
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 3cff2861a56..cc1240c008e 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.23 2001/09/27 19:29:50 christos Exp $ */
+/* $NetBSD: el.c,v 1.24 2001/10/09 13:50:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.23 2001/09/27 19:29:50 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.24 2001/10/09 13:50:30 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -255,6 +255,10 @@ el_set(EditLine *el, int op, ...)
break;
}
+ case EL_CLIENTDATA:
+ el->el_data = va_arg(va, void *);
+ break;
+
default:
rv = -1;
}
@@ -370,6 +374,11 @@ el_get(EditLine *el, int op, void *ret)
rv = 0;
break;
+ case EL_CLIENTDATA:
+ *((void **)ret) = el->el_data;
+ rv = 0;
+ break;
+
default:
rv = -1;
}
diff --git a/lib/libedit/el.h b/lib/libedit/el.h
index ac28d0c20fd..9e8f5e2608e 100644
--- a/lib/libedit/el.h
+++ b/lib/libedit/el.h
@@ -1,4 +1,4 @@
-/* $NetBSD: el.h,v 1.9 2001/09/27 19:29:50 christos Exp $ */
+/* $NetBSD: el.h,v 1.10 2001/10/09 13:50:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -117,6 +117,7 @@ struct editline {
coord_t el_cursor; /* Cursor location */
char **el_display; /* Real screen image = what is there */
char **el_vdisplay; /* Virtual screen image = what we see */
+ void *el_data; /* Client data */
el_line_t el_line; /* The current line information */
el_state_t el_state; /* Current editor state */
el_term_t el_term; /* Terminal dependent stuff */
diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h
index 9c3a2dc2401..9bdebbdbd1f 100644
--- a/lib/libedit/histedit.h
+++ b/lib/libedit/histedit.h
@@ -1,4 +1,4 @@
-/* $NetBSD: histedit.h,v 1.17 2001/09/27 19:29:50 christos Exp $ */
+/* $NetBSD: histedit.h,v 1.18 2001/10/09 13:50:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -127,6 +127,7 @@ int el_get(EditLine *, int, void *);
#define EL_EDITMODE 11 /* , int); */
#define EL_RPROMPT 12 /* , el_pfunc_t); */
#define EL_GETCFN 13 /* , el_rfunc_t); */
+#define EL_CLIENTDATA 14 /* , void *); */
#define EL_BUILTIN_GETCFN (NULL)
diff --git a/lib/libedit/shlib_version b/lib/libedit/shlib_version
index 24699bb9eb0..edd3802dfad 100644
--- a/lib/libedit/shlib_version
+++ b/lib/libedit/shlib_version
@@ -1,5 +1,5 @@
-# $NetBSD: shlib_version,v 1.11 2001/01/01 15:54:07 jdolecek Exp $
+# $NetBSD: shlib_version,v 1.12 2001/10/09 13:50:30 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=2
-minor=5
+minor=6