mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
MFV r295360
Sync our libedit with NetBSD's libedit 2016-01-16 Obtained from: NetBSD
This commit is contained in:
commit
56f42903b1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295369
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user