summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2016-02-08 12:16:01 +0000
committerGlen Barber <gjb@FreeBSD.org>2016-02-08 12:16:01 +0000
commitbbb51924bb60b8c8f7dfbb7069b1511c312b9b57 (patch)
tree06859f2b48e0d90b7e6715c5a5045b4b24de5822 /lib/libedit
parentc389411c8aa86e3ffa6e7b24ecef1d8c94549bb8 (diff)
parent2dab579bfc8c1b8169c9247fec50bfd0155bc06d (diff)
downloadsrc-test-bbb51924bb60b8c8f7dfbb7069b1511c312b9b57.tar.gz
src-test-bbb51924bb60b8c8f7dfbb7069b1511c312b9b57.zip
MFH
Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/projects/release-pkg/; revision=295394
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/editline.361
-rw-r--r--lib/libedit/el.c7
-rw-r--r--lib/libedit/hist.h6
-rw-r--r--lib/libedit/keymacro.h4
-rw-r--r--lib/libedit/search.c6
-rw-r--r--lib/libedit/tokenizer.c6
-rw-r--r--lib/libedit/tty.c7
7 files changed, 54 insertions, 43 deletions
diff --git a/lib/libedit/editline.3 b/lib/libedit/editline.3
index 1e0ff5da7f84a..05ee76eb7769d 100644
--- a/lib/libedit/editline.3
+++ b/lib/libedit/editline.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: editline.3,v 1.84 2014/12/25 13:39:41 wiz Exp $
+.\" $NetBSD: editline.3,v 1.85 2015/11/03 21:36:59 christos Exp $
.\"
.\" Copyright (c) 1997-2014 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 25, 2014
+.Dd November 3, 2015
.Dt EDITLINE 3
.Os
.Sh NAME
@@ -191,7 +191,7 @@ counterparts.
The following functions are available:
.Bl -tag -width 4n
.It Fn el_init
-Initialise the line editor, and return a data structure
+Initialize the line editor, and return a data structure
to be used by all other line editing functions, or
.Dv NULL
on failure.
@@ -521,61 +521,68 @@ are supported, along with actual type of
.Fa result :
.Bl -tag -width 4n
.It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
-Return a pointer to the function that displays the prompt in
+Set
.Fa f .
+to a pointer to the function that displays the prompt.
If
.Fa c
is not
.Dv NULL ,
-return the start/stop literal prompt character in it.
+set it to the start/stop literal prompt character.
.It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
-Return a pointer to the function that displays the prompt in
+Set
.Fa f .
+to a pointer to the function that displays the prompt.
If
.Fa c
is not
.Dv NULL ,
-return the start/stop literal prompt character in it.
-.It Dv EL_EDITOR , Fa "const char **"
-Return the name of the editor, which will be one of
+set it to the start/stop literal prompt character.
+.It Dv EL_EDITOR , Fa "const char **n"
+Set the name of the editor in
+.Fa n ,
+which will be one of
.Dq emacs
or
.Dq vi .
.It Dv EL_GETTC , Fa "const char *name" , Fa "void *value"
-Return non-zero if
+If
.Fa name
is a valid
.Xr termcap 5
-capability
-and set
+capability set
.Fa value
to the current value of that capability.
-.It Dv EL_SIGNAL , Fa "int *"
-Return non-zero if
+.It Dv EL_SIGNAL , Fa "int *s"
+Set
+.Fa s
+to non zero if
.Nm
has installed private signal handlers (see
.Fn el_get
above).
-.It Dv EL_EDITMODE , Fa "int *"
-Return non-zero if editing is enabled.
+.It Dv EL_EDITMODE , Fa "int *c"
+Set
+.Fa c
+to 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
.Dq Dv EL_BUILTIN_GETCFN
in the case of the default builtin function.
.It Dv EL_CLIENTDATA , Fa "void **data"
-Retrieve
+Set
.Fa data
-previously registered with the corresponding
+to the previously registered client data set by an
.Fn el_set
call.
-.It Dv EL_UNBUFFERED , Fa "int"
-Return non-zero if unbuffered mode is enabled.
-.It Dv EL_PREP_TERM , Fa "int"
-Sets or clears terminal editing mode.
+.It Dv EL_UNBUFFERED , Fa "int *c"
+Set
+.Fa c
+to non-zero if unbuffered mode is enabled.
.It Dv EL_GETFP , Fa "int fd", Fa "FILE **fp"
-Return in
+Set
.Fa fp
-the current
+to the current
.Nm editline
file pointer for
.Dq input
@@ -593,7 +600,7 @@ or
.Dv 2 .
.El
.It Fn el_source
-Initialise
+Initialize
.Nm
by reading the contents of
.Fa file .
@@ -671,7 +678,7 @@ and freed by
The following functions are available:
.Bl -tag -width 4n
.It Fn history_init
-Initialise the history list, and return a data structure
+Initialize the history list, and return a data structure
to be used by all other history list functions, or
.Dv NULL
on failure.
@@ -810,7 +817,7 @@ and freed by
The following functions are available:
.Bl -tag -width 4n
.It Fn tok_init
-Initialise the tokenizer, and return a data structure
+Initialize the tokenizer, and return a data structure
to be used by all other tokenizer functions.
.Fa IFS
contains the Input Field Separators, which defaults to
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 57ea6e55cffd9..65bd86b7b1303 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.73 2014/06/18 18:12:28 christos Exp $ */
+/* $NetBSD: el.c,v 1.74 2015/12/08 12:56:55 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.73 2014/06/18 18:12:28 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.74 2015/12/08 12:56:55 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
@@ -137,7 +137,8 @@ el_end(EditLine *el)
terminal_end(el);
keymacro_end(el);
map_end(el);
- tty_end(el);
+ if (!(el->el_flags & NO_TTY))
+ tty_end(el);
ch_end(el);
search_end(el);
hist_end(el);
diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h
index 1cd7d9df397f6..6ca6877301f0e 100644
--- a/lib/libedit/hist.h
+++ b/lib/libedit/hist.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hist.h,v 1.14 2014/05/11 01:05:17 christos Exp $ */
+/* $NetBSD: hist.h,v 1.15 2016/01/30 15:05:27 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -47,10 +47,10 @@ typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...);
typedef struct el_history_t {
Char *buf; /* The history buffer */
- size_t sz; /* Size of history buffer */
+ size_t sz; /* Size of history buffer */
Char *last; /* The last character */
int eventno; /* Event we are looking for */
- void * ref; /* Argument for history fcns */
+ void *ref; /* Argument for history fcns */
hist_fun_t fun; /* Event access */
TYPE(HistEvent) ev; /* Event cookie */
} el_history_t;
diff --git a/lib/libedit/keymacro.h b/lib/libedit/keymacro.h
index 57a7a5d2ea8dc..139cda2722e7b 100644
--- a/lib/libedit/keymacro.h
+++ b/lib/libedit/keymacro.h
@@ -1,4 +1,4 @@
-/* $NetBSD: keymacro.h,v 1.2 2011/07/28 03:44:36 christos Exp $ */
+/* $NetBSD: keymacro.h,v 1.3 2016/01/29 19:59:11 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -48,7 +48,7 @@ typedef union keymacro_value_t {
typedef struct keymacro_node_t keymacro_node_t;
-typedef struct el_keymacromacro_t {
+typedef struct el_keymacro_t {
Char *buf; /* Key print buffer */
keymacro_node_t *map; /* Key map */
keymacro_value_t val; /* Local conversion buffer */
diff --git a/lib/libedit/search.c b/lib/libedit/search.c
index 3cd205a9453e0..df9999cf373e6 100644
--- a/lib/libedit/search.c
+++ b/lib/libedit/search.c
@@ -1,4 +1,4 @@
-/* $NetBSD: search.c,v 1.30 2011/10/04 15:27:04 christos Exp $ */
+/* $NetBSD: search.c,v 1.31 2016/01/30 04:02:51 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: search.c,v 1.30 2011/10/04 15:27:04 christos Exp $");
+__RCSID("$NetBSD: search.c,v 1.31 2016/01/30 04:02:51 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
@@ -149,7 +149,7 @@ el_match(const Char *str, const Char *pat)
if (re_comp(ct_encode_string(pat, &conv)) != NULL)
return 0;
else
- return re_exec(ct_encode_string(str, &conv) == 1);
+ return re_exec(ct_encode_string(str, &conv)) == 1;
#endif
}
diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c
index e61ecaf41e40d..f5171c46d2ec3 100644
--- a/lib/libedit/tokenizer.c
+++ b/lib/libedit/tokenizer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tokenizer.c,v 1.21 2011/08/16 16:25:15 christos Exp $ */
+/* $NetBSD: tokenizer.c,v 1.22 2016/01/30 04:02:51 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tokenizer.c,v 1.21 2011/08/16 16:25:15 christos Exp $");
+__RCSID("$NetBSD: tokenizer.c,v 1.22 2016/01/30 04:02:51 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
@@ -448,5 +448,5 @@ FUN(tok,str)(TYPE(Tokenizer) *tok, const Char *line, int *argc,
memset(&li, 0, sizeof(li));
li.buffer = line;
li.cursor = li.lastchar = Strchr(line, '\0');
- return FUN(tok,line(tok, &li, argc, argv, NULL, NULL));
+ return FUN(tok,line)(tok, &li, argc, argv, NULL, NULL);
}
diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c
index ecf2e2a213350..a508e43ef37cc 100644
--- a/lib/libedit/tty.c
+++ b/lib/libedit/tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.47 2015/05/14 10:44:15 christos Exp $ */
+/* $NetBSD: tty.c,v 1.49 2015/12/08 16:53:27 gson Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tty.c,v 1.47 2015/05/14 10:44:15 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.49 2015/12/08 16:53:27 gson Exp $");
#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
@@ -582,6 +582,9 @@ protected void
/*ARGSUSED*/
tty_end(EditLine *el)
{
+ if (el->el_flags & EDIT_DISABLED)
+ return;
+
if (tty_setty(el, TCSAFLUSH, &el->el_tty.t_or) == -1) {
#ifdef DEBUG_TTY
(void) fprintf(el->el_errfile,