libedit: import version 2023-02-06
This commit is contained in:
parent
6da940f2c7
commit
5a36c82614
11
chared.c
11
chared.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: chared.c,v 1.62 2022/02/08 21:13:22 rillig Exp $ */
|
/* $NetBSD: chared.c,v 1.63 2022/10/30 19:11:31 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: chared.c,v 1.62 2022/02/08 21:13:22 rillig Exp $");
|
__RCSID("$NetBSD: chared.c,v 1.63 2022/10/30 19:11:31 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ ch_init(EditLine *el)
|
|||||||
el->el_chared.c_redo.buf = el_calloc(EL_BUFSIZ,
|
el->el_chared.c_redo.buf = el_calloc(EL_BUFSIZ,
|
||||||
sizeof(*el->el_chared.c_redo.buf));
|
sizeof(*el->el_chared.c_redo.buf));
|
||||||
if (el->el_chared.c_redo.buf == NULL)
|
if (el->el_chared.c_redo.buf == NULL)
|
||||||
return -1;
|
goto out;
|
||||||
el->el_chared.c_redo.pos = el->el_chared.c_redo.buf;
|
el->el_chared.c_redo.pos = el->el_chared.c_redo.buf;
|
||||||
el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ;
|
el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ;
|
||||||
el->el_chared.c_redo.cmd = ED_UNASSIGNED;
|
el->el_chared.c_redo.cmd = ED_UNASSIGNED;
|
||||||
@ -425,7 +425,7 @@ ch_init(EditLine *el)
|
|||||||
el->el_chared.c_kill.buf = el_calloc(EL_BUFSIZ,
|
el->el_chared.c_kill.buf = el_calloc(EL_BUFSIZ,
|
||||||
sizeof(*el->el_chared.c_kill.buf));
|
sizeof(*el->el_chared.c_kill.buf));
|
||||||
if (el->el_chared.c_kill.buf == NULL)
|
if (el->el_chared.c_kill.buf == NULL)
|
||||||
return -1;
|
goto out;
|
||||||
el->el_chared.c_kill.mark = el->el_line.buffer;
|
el->el_chared.c_kill.mark = el->el_line.buffer;
|
||||||
el->el_chared.c_kill.last = el->el_chared.c_kill.buf;
|
el->el_chared.c_kill.last = el->el_chared.c_kill.buf;
|
||||||
el->el_chared.c_resizefun = NULL;
|
el->el_chared.c_resizefun = NULL;
|
||||||
@ -442,6 +442,9 @@ ch_init(EditLine *el)
|
|||||||
el->el_state.lastcmd = ED_UNASSIGNED;
|
el->el_state.lastcmd = ED_UNASSIGNED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
out:
|
||||||
|
ch_end(el);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ch_reset():
|
/* ch_reset():
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: chartype.c,v 1.35 2019/07/23 10:18:52 christos Exp $ */
|
/* $NetBSD: chartype.c,v 1.36 2022/10/30 19:11:31 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#if !defined(lint) && !defined(SCCSID)
|
#if !defined(lint) && !defined(SCCSID)
|
||||||
__RCSID("$NetBSD: chartype.c,v 1.35 2019/07/23 10:18:52 christos Exp $");
|
__RCSID("$NetBSD: chartype.c,v 1.36 2022/10/30 19:11:31 christos Exp $");
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -158,6 +158,8 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wargv = el_calloc((size_t)(argc + 1), sizeof(*wargv));
|
wargv = el_calloc((size_t)(argc + 1), sizeof(*wargv));
|
||||||
|
if (wargv == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for (i = 0, p = conv->wbuff; i < argc; ++i) {
|
for (i = 0, p = conv->wbuff; i < argc; ++i) {
|
||||||
if (!argv[i]) { /* don't pass null pointers to mbstowcs */
|
if (!argv[i]) { /* don't pass null pointers to mbstowcs */
|
||||||
|
255
config.h
255
config.h
@ -1,31 +1,6 @@
|
|||||||
/* config.h. Generated from config.h.in by configure. */
|
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
|
||||||
/* #undef CLOSEDIR_VOID */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <curses.h> header file. */
|
/* Define to 1 if you have the <curses.h> header file. */
|
||||||
#define HAVE_CURSES_H 1
|
#define HAVE_CURSES_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
|
||||||
*/
|
|
||||||
#define HAVE_DIRENT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
||||||
#define HAVE_DLFCN_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `endpwent' function. */
|
|
||||||
#define HAVE_ENDPWENT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
|
||||||
#define HAVE_FCNTL_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getline' function. */
|
|
||||||
#define HAVE_GETLINE 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `fork' function. */
|
|
||||||
#define HAVE_FORK 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1
|
/* Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1
|
||||||
versions. */
|
versions. */
|
||||||
/* #undef HAVE_GETPW_R_DRAFT */
|
/* #undef HAVE_GETPW_R_DRAFT */
|
||||||
@ -34,253 +9,23 @@
|
|||||||
compatible. */
|
compatible. */
|
||||||
#define HAVE_GETPW_R_POSIX 1
|
#define HAVE_GETPW_R_POSIX 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `isascii' function. */
|
|
||||||
#define HAVE_ISASCII 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `issetugid' function. */
|
/* Define to 1 if you have the `issetugid' function. */
|
||||||
#define HAVE_ISSETUGID 1
|
#define HAVE_ISSETUGID 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `curses' library (-lcurses). */
|
|
||||||
/* #undef HAVE_LIBCURSES */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `ncurses' library (-lncurses). */
|
|
||||||
/* #undef HAVE_LIBNCURSES */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `termcap' library (-ltermcap). */
|
|
||||||
/* #undef HAVE_LIBTERMCAP */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `terminfo' library (-lterminfo). */
|
|
||||||
#define HAVE_LIBTERMINFO 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `termlib' library (-ltermlib). */
|
|
||||||
/* #undef HAVE_LIBTERMLIB */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <limits.h> header file. */
|
|
||||||
#define HAVE_LIMITS_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <malloc.h> header file. */
|
|
||||||
#define HAVE_MALLOC_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `memchr' function. */
|
|
||||||
#define HAVE_MEMCHR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `memset' function. */
|
|
||||||
#define HAVE_MEMSET 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <ncurses.h> header file. */
|
/* Define to 1 if you have the <ncurses.h> header file. */
|
||||||
/* #undef HAVE_NCURSES_H */
|
/* #undef HAVE_NCURSES_H */
|
||||||
|
|
||||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
|
||||||
/* #undef HAVE_NDIR_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `regcomp' function. */
|
|
||||||
#define HAVE_REGCOMP 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `re_comp' function. */
|
|
||||||
/* #undef HAVE_RE_COMP */
|
|
||||||
|
|
||||||
/* Define to 1 if `stat' has the bug that it succeeds when given the
|
|
||||||
zero-length file name argument. */
|
|
||||||
/* #undef HAVE_STAT_EMPTY_STRING_BUG */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strcasecmp' function. */
|
|
||||||
#define HAVE_STRCASECMP 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strchr' function. */
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strcspn' function. */
|
|
||||||
#define HAVE_STRCSPN 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strdup' function. */
|
|
||||||
#define HAVE_STRDUP 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strerror' function. */
|
|
||||||
#define HAVE_STRERROR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strlcat' function. */
|
|
||||||
#define HAVE_STRLCAT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strlcpy' function. */
|
|
||||||
#define HAVE_STRLCPY 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strrchr' function. */
|
|
||||||
#define HAVE_STRRCHR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strstr' function. */
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strtol' function. */
|
|
||||||
#define HAVE_STRTOL 1
|
|
||||||
|
|
||||||
/* Define to 1 if struct dirent has member d_namlen */
|
/* Define to 1 if struct dirent has member d_namlen */
|
||||||
#define HAVE_STRUCT_DIRENT_D_NAMLEN 1
|
#define HAVE_STRUCT_DIRENT_D_NAMLEN 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `strunvis' function. */
|
|
||||||
#define HAVE_STRUNVIS 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strvis' function. */
|
|
||||||
#define HAVE_STRVIS 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||||
#define HAVE_SYS_CDEFS_H 1
|
#define HAVE_SYS_CDEFS_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
|
||||||
*/
|
|
||||||
/* #undef HAVE_SYS_DIR_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
|
||||||
#define HAVE_SYS_IOCTL_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
|
||||||
*/
|
|
||||||
/* #undef HAVE_SYS_NDIR_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
|
||||||
#define HAVE_SYS_PARAM_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
|
||||||
#define HAVE_SYS_WAIT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <termcap.h> header file. */
|
/* Define to 1 if you have the <termcap.h> header file. */
|
||||||
#define HAVE_TERMCAP_H 1
|
#define HAVE_TERMCAP_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <term.h> header file. */
|
/* Define to 1 if you have the <term.h> header file. */
|
||||||
#define HAVE_TERM_H 1
|
#define HAVE_TERM_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `u_int32_t'. */
|
|
||||||
#define HAVE_U_INT32_T 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `vfork' function. */
|
|
||||||
#define HAVE_VFORK 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <vfork.h> header file. */
|
|
||||||
/* #undef HAVE_VFORK_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `vis' function. */
|
|
||||||
#define HAVE_VIS 1
|
|
||||||
|
|
||||||
/* Define to 1 if `fork' works. */
|
|
||||||
#define HAVE_WORKING_FORK 1
|
|
||||||
|
|
||||||
/* Define to 1 if `vfork' works. */
|
|
||||||
#define HAVE_WORKING_VFORK 1
|
|
||||||
|
|
||||||
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
|
|
||||||
slash. */
|
|
||||||
#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
|
|
||||||
|
|
||||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||||
*/
|
|
||||||
#define LT_OBJDIR ".libs/"
|
|
||||||
|
|
||||||
/* Name of package */
|
|
||||||
#define PACKAGE "libedit-20110729"
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#define PACKAGE_BUGREPORT ""
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#define PACKAGE_NAME "libedit"
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#define PACKAGE_STRING "libedit 3.0"
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#define PACKAGE_TARNAME "libedit-20110729"
|
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#define PACKAGE_URL ""
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#define PACKAGE_VERSION "3.0"
|
|
||||||
|
|
||||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
|
||||||
#define RETSIGTYPE void
|
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
|
|
||||||
/* Enable extensions on AIX 3, Interix. */
|
|
||||||
#ifndef _ALL_SOURCE
|
|
||||||
# define _ALL_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable GNU extensions on systems that have them. */
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable threading extensions on Solaris. */
|
|
||||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
|
||||||
# define _POSIX_PTHREAD_SEMANTICS 1
|
|
||||||
#endif
|
|
||||||
/* Enable extensions on HP NonStop. */
|
|
||||||
#ifndef _TANDEM_SOURCE
|
|
||||||
# define _TANDEM_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable general extensions on Solaris. */
|
|
||||||
#ifndef __EXTENSIONS__
|
|
||||||
# define __EXTENSIONS__ 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Version number of package */
|
|
||||||
#define VERSION "3.0"
|
|
||||||
|
|
||||||
/* Define to 1 if the system provides the SIZE_MAX constant */
|
|
||||||
#define HAVE_SIZE_MAX 1
|
|
||||||
|
|
||||||
/* Define to 1 if on MINIX. */
|
|
||||||
/* #undef _MINIX */
|
|
||||||
|
|
||||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
|
||||||
this defined. */
|
|
||||||
/* #undef _POSIX_1_SOURCE */
|
|
||||||
|
|
||||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
|
||||||
/* #undef _POSIX_SOURCE */
|
|
||||||
|
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
|
||||||
/* #undef const */
|
|
||||||
|
|
||||||
/* Define to `int' if <sys/types.h> does not define. */
|
|
||||||
/* #undef pid_t */
|
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
|
||||||
/* #undef size_t */
|
|
||||||
|
|
||||||
/* Define as `fork' if `vfork' does not work. */
|
|
||||||
/* #undef vfork */
|
|
||||||
|
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
/* #undef SCCSID */
|
|
||||||
/* #undef LIBC_SCCS */
|
|
||||||
/* #undef lint */
|
|
||||||
|
|
||||||
|
91
editrc.5
91
editrc.5
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: editrc.5,v 1.33 2017/06/27 01:22:58 kre Exp $
|
.\" $NetBSD: editrc.5,v 1.34 2022/12/06 00:59:20 uwe Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@ -43,7 +43,7 @@ library.
|
|||||||
.Pp
|
.Pp
|
||||||
The format of each line is:
|
The format of each line is:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl [prog:]command [arg ...]
|
.D1 Oo Ar prog Ns Ic \&: Oc Ns Ar command Oo Ar arg ... Oc
|
||||||
.Pp
|
.Pp
|
||||||
.Ar command
|
.Ar command
|
||||||
is one of the
|
is one of the
|
||||||
@ -59,7 +59,7 @@ is the program name string that a program defines when it calls
|
|||||||
to set up
|
to set up
|
||||||
.Xr editline 3 ,
|
.Xr editline 3 ,
|
||||||
which is usually
|
which is usually
|
||||||
.Va argv[0] .
|
.Va argv Ns Li [0] .
|
||||||
.Ar command
|
.Ar command
|
||||||
will be executed for any program which matches
|
will be executed for any program which matches
|
||||||
.Ar prog .
|
.Ar prog .
|
||||||
@ -107,15 +107,17 @@ List or change key bindings in the
|
|||||||
.Xr vi 1
|
.Xr vi 1
|
||||||
mode alternate (command mode) key map.
|
mode alternate (command mode) key map.
|
||||||
.It Fl e
|
.It Fl e
|
||||||
Bind all keys to the standard GNU Emacs-like bindings.
|
Bind all keys to the standard
|
||||||
|
.Tn GNU
|
||||||
|
Emacs-like bindings.
|
||||||
.It Fl k
|
.It Fl k
|
||||||
.Ar key
|
.Ar key
|
||||||
is interpreted as a symbolic arrow key name, which may be one of
|
is interpreted as a symbolic arrow key name, which may be one of
|
||||||
.Sq up ,
|
.Ic up ,
|
||||||
.Sq down ,
|
.Ic down ,
|
||||||
.Sq left
|
.Ic left
|
||||||
or
|
or
|
||||||
.Sq right .
|
.Ic right .
|
||||||
.It Fl l
|
.It Fl l
|
||||||
List all editor commands and a short description of each.
|
List all editor commands and a short description of each.
|
||||||
.It Fl r
|
.It Fl r
|
||||||
@ -146,16 +148,14 @@ about macros and the input queue.
|
|||||||
and
|
and
|
||||||
.Ar command
|
.Ar command
|
||||||
can contain control characters of the form
|
can contain control characters of the form
|
||||||
.Sm off
|
.Sq Ic ^ Ns Ar character
|
||||||
.Sq No ^ Ar character
|
|
||||||
.Sm on
|
|
||||||
.Po
|
.Po
|
||||||
e.g.\&
|
e.g.\&
|
||||||
.Sq ^A
|
.Ql ^A
|
||||||
.Pc ,
|
.Pc ,
|
||||||
and the following backslashed escape sequences:
|
and the following backslashed escape sequences:
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -tag -compact -offset indent -width 4n
|
.Bl -tag -compact -offset indent -width Ic
|
||||||
.It Ic \ea
|
.It Ic \ea
|
||||||
Bell
|
Bell
|
||||||
.It Ic \eb
|
.It Ic \eb
|
||||||
@ -173,31 +173,33 @@ Horizontal tab
|
|||||||
.It Ic \ev
|
.It Ic \ev
|
||||||
Vertical tab
|
Vertical tab
|
||||||
.Sm off
|
.Sm off
|
||||||
.It Sy \e Ar nnn
|
.It Ic \e Ar nnn
|
||||||
.Sm on
|
.Sm on
|
||||||
The ASCII character corresponding to the octal number
|
The
|
||||||
|
.Tn ASCII
|
||||||
|
character corresponding to the octal number
|
||||||
.Ar nnn .
|
.Ar nnn .
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
.Sq \e
|
.Ql \e
|
||||||
nullifies the special meaning of the following character,
|
nullifies the special meaning of the following character,
|
||||||
if it has any, notably
|
if it has any, notably
|
||||||
.Sq \e
|
.Ql \e
|
||||||
and
|
and
|
||||||
.Sq ^ .
|
.Ql ^ .
|
||||||
.It Ic echotc Oo Fl sv Oc Ar arg Ar ...
|
.It Ic echotc Oo Fl sv Oc Ar arg Ar ...
|
||||||
Exercise terminal capabilities given in
|
Exercise terminal capabilities given in
|
||||||
.Ar arg ... .
|
.Ar arg .
|
||||||
If
|
If
|
||||||
.Ar arg
|
.Ar arg
|
||||||
is
|
is
|
||||||
.Sq baud ,
|
.Ql baud ,
|
||||||
.Sq cols ,
|
.Ql cols ,
|
||||||
.Sq lines ,
|
.Ql lines ,
|
||||||
.Sq rows ,
|
.Ql rows ,
|
||||||
.Sq meta ,
|
.Ql meta ,
|
||||||
or
|
or
|
||||||
.Sq tabs ,
|
.Ql tabs ,
|
||||||
the value of that capability is printed, with
|
the value of that capability is printed, with
|
||||||
.Dq yes
|
.Dq yes
|
||||||
or
|
or
|
||||||
@ -209,27 +211,27 @@ returns an empty string for non-existent capabilities, rather than
|
|||||||
causing an error.
|
causing an error.
|
||||||
.Fl v
|
.Fl v
|
||||||
causes messages to be verbose.
|
causes messages to be verbose.
|
||||||
.It Ic edit Op Li on | Li off
|
.It Ic edit Op Li on No | Li off
|
||||||
Enable or disable the
|
Enable or disable the
|
||||||
.Nm editline
|
.Nm editline
|
||||||
functionality in a program.
|
functionality in a program.
|
||||||
.It Ic history Ar list | Ar size Dv n | Ar unique Dv n
|
.It Ic history Li list No | Li size Ar n No | Li unique Ar n
|
||||||
The
|
The
|
||||||
.Ar list
|
.Ql list
|
||||||
command lists all entries in the history.
|
command lists all entries in the history.
|
||||||
The
|
The
|
||||||
.Ar size
|
.Ql size
|
||||||
command sets the history size to
|
command sets the history size to
|
||||||
.Dv n
|
.Ar n
|
||||||
entries.
|
entries.
|
||||||
The
|
The
|
||||||
.Ar unique
|
.Ql unique
|
||||||
command controls if history should keep duplicate entries.
|
command controls if history should keep duplicate entries.
|
||||||
If
|
If
|
||||||
.Dv n
|
.Ar n
|
||||||
is non zero, only keep unique history entries.
|
is non zero, only keep unique history entries.
|
||||||
If
|
If
|
||||||
.Dv n
|
.Ar n
|
||||||
is zero, then keep all entries (the default).
|
is zero, then keep all entries (the default).
|
||||||
.It Ic settc Ar cap Ar val
|
.It Ic settc Ar cap Ar val
|
||||||
Set the terminal capability
|
Set the terminal capability
|
||||||
@ -239,8 +241,8 @@ to
|
|||||||
as defined in
|
as defined in
|
||||||
.Xr termcap 5 .
|
.Xr termcap 5 .
|
||||||
No sanity checking is done.
|
No sanity checking is done.
|
||||||
.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \
|
.It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ic \&+ Ns Ar mode Oc \
|
||||||
Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=c Oc
|
Oo Fl Ar mode Oc Oo Ar mode Oc Oo Ar char\| Ns Ic = Ns Ar c Oc
|
||||||
Control which tty modes that
|
Control which tty modes that
|
||||||
.Nm
|
.Nm
|
||||||
won't allow the user to change.
|
won't allow the user to change.
|
||||||
@ -262,17 +264,17 @@ Without other arguments,
|
|||||||
.Ic setty
|
.Ic setty
|
||||||
lists the modes in the chosen set which are fixed on
|
lists the modes in the chosen set which are fixed on
|
||||||
.Po
|
.Po
|
||||||
.Sq +mode
|
.Ic + Ns Ar mode
|
||||||
.Pc
|
.Pc
|
||||||
or off
|
or off
|
||||||
.Po
|
.Po
|
||||||
.Sq -mode
|
.Fl Ns Ar mode
|
||||||
.Pc .
|
.Pc .
|
||||||
.Fl a
|
.Fl a
|
||||||
lists all tty modes in the chosen set regardless of the setting.
|
lists all tty modes in the chosen set regardless of the setting.
|
||||||
With
|
With
|
||||||
.Ar +mode ,
|
.Ic + Ns Ar mode ,
|
||||||
.Ar -mode
|
.Fl Ns Ar mode
|
||||||
or
|
or
|
||||||
.Ar mode ,
|
.Ar mode ,
|
||||||
fixes
|
fixes
|
||||||
@ -283,7 +285,7 @@ in the chosen set.
|
|||||||
.Pp
|
.Pp
|
||||||
.Ic Setty
|
.Ic Setty
|
||||||
can also be used to set tty characters to particular values using
|
can also be used to set tty characters to particular values using
|
||||||
.Ar char=value .
|
.Ar char\| Ns Ic = Ns Ar value .
|
||||||
If
|
If
|
||||||
.Ar value
|
.Ar value
|
||||||
is empty
|
is empty
|
||||||
@ -294,19 +296,18 @@ List the values of all the terminal capabilities (see
|
|||||||
.Xr termcap 5 ) .
|
.Xr termcap 5 ) .
|
||||||
.El
|
.El
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Bl -tag -width "~/.editrcXXX"
|
.Bl -tag -width Ev
|
||||||
.It Ev EDITRC
|
.It Ev EDITRC
|
||||||
Names the default configuration file for the
|
Names the default configuration file for the
|
||||||
.Xr editline 3
|
.Xr editline 3
|
||||||
library.
|
library.
|
||||||
.El
|
.El
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width "~/.editrcXXX"
|
.Bl -tag -width Pa
|
||||||
.It Pa ~/.editrc
|
.It Pa ~/.editrc
|
||||||
Last resort, if no other file is specified,
|
Last resort user configuration file for the
|
||||||
user configuration file for the
|
|
||||||
.Xr editline 3
|
.Xr editline 3
|
||||||
library.
|
library if no other file is specified.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr editline 3 ,
|
.Xr editline 3 ,
|
||||||
|
6
el.c
6
el.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: el.c,v 1.100 2021/08/15 10:08:41 christos Exp $ */
|
/* $NetBSD: el.c,v 1.101 2022/10/30 19:11:31 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
|
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: el.c,v 1.100 2021/08/15 10:08:41 christos Exp $");
|
__RCSID("$NetBSD: el.c,v 1.101 2022/10/30 19:11:31 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ el_end(EditLine *el)
|
|||||||
if (!(el->el_flags & NO_TTY))
|
if (!(el->el_flags & NO_TTY))
|
||||||
tty_end(el, TCSAFLUSH);
|
tty_end(el, TCSAFLUSH);
|
||||||
ch_end(el);
|
ch_end(el);
|
||||||
read_end(el->el_read);
|
read_end(el);
|
||||||
search_end(el);
|
search_end(el);
|
||||||
hist_end(el);
|
hist_end(el);
|
||||||
prompt_end(el);
|
prompt_end(el);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: filecomplete.c,v 1.70 2022/03/12 15:29:17 christos Exp $ */
|
/* $NetBSD: filecomplete.c,v 1.72 2023/02/03 22:01:42 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#if !defined(lint) && !defined(SCCSID)
|
#if !defined(lint) && !defined(SCCSID)
|
||||||
__RCSID("$NetBSD: filecomplete.c,v 1.70 2022/03/12 15:29:17 christos Exp $");
|
__RCSID("$NetBSD: filecomplete.c,v 1.72 2023/02/03 22:01:42 christos Exp $");
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -637,6 +637,8 @@ find_word_to_complete(const wchar_t * cursor, const wchar_t * buffer,
|
|||||||
return unescaped_word;
|
return unescaped_word;
|
||||||
}
|
}
|
||||||
temp = el_malloc((len + 1) * sizeof(*temp));
|
temp = el_malloc((len + 1) * sizeof(*temp));
|
||||||
|
if (temp == NULL)
|
||||||
|
return NULL;
|
||||||
(void) wcsncpy(temp, ctemp, len);
|
(void) wcsncpy(temp, ctemp, len);
|
||||||
temp[len] = '\0';
|
temp[len] = '\0';
|
||||||
return temp;
|
return temp;
|
||||||
@ -849,3 +851,13 @@ _el_fn_complete(EditLine *el, int ch __attribute__((__unused__)))
|
|||||||
break_chars, NULL, NULL, (size_t)100,
|
break_chars, NULL, NULL, (size_t)100,
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* el-compatible wrapper around rl_complete; needed for key binding
|
||||||
|
*/
|
||||||
|
/* ARGSUSED */
|
||||||
|
unsigned char
|
||||||
|
_el_fn_sh_complete(EditLine *el, int ch)
|
||||||
|
{
|
||||||
|
return _el_fn_complete(el, ch);
|
||||||
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: histedit.h,v 1.61 2022/02/08 21:13:22 rillig Exp $ */
|
/* $NetBSD: histedit.h,v 1.62 2023/02/03 22:01:42 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -113,6 +113,7 @@ int el_parse(EditLine *, int, const char **);
|
|||||||
int el_set(EditLine *, int, ...);
|
int el_set(EditLine *, int, ...);
|
||||||
int el_get(EditLine *, int, ...);
|
int el_get(EditLine *, int, ...);
|
||||||
unsigned char _el_fn_complete(EditLine *, int);
|
unsigned char _el_fn_complete(EditLine *, int);
|
||||||
|
unsigned char _el_fn_sh_complete(EditLine *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* el_set/el_get parameters
|
* el_set/el_get parameters
|
||||||
|
13
map.c
13
map.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: map.c,v 1.54 2021/08/29 09:41:59 christos Exp $ */
|
/* $NetBSD: map.c,v 1.55 2022/10/30 19:11:31 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: map.c,v 1.54 2021/08/29 09:41:59 christos Exp $");
|
__RCSID("$NetBSD: map.c,v 1.55 2022/10/30 19:11:31 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -918,18 +918,18 @@ map_init(EditLine *el)
|
|||||||
return -1;
|
return -1;
|
||||||
el->el_map.key = el_calloc(N_KEYS, sizeof(*el->el_map.key));
|
el->el_map.key = el_calloc(N_KEYS, sizeof(*el->el_map.key));
|
||||||
if (el->el_map.key == NULL)
|
if (el->el_map.key == NULL)
|
||||||
return -1;
|
goto out;
|
||||||
el->el_map.emacs = el_map_emacs;
|
el->el_map.emacs = el_map_emacs;
|
||||||
el->el_map.vic = el_map_vi_command;
|
el->el_map.vic = el_map_vi_command;
|
||||||
el->el_map.vii = el_map_vi_insert;
|
el->el_map.vii = el_map_vi_insert;
|
||||||
el->el_map.help = el_calloc(EL_NUM_FCNS, sizeof(*el->el_map.help));
|
el->el_map.help = el_calloc(EL_NUM_FCNS, sizeof(*el->el_map.help));
|
||||||
if (el->el_map.help == NULL)
|
if (el->el_map.help == NULL)
|
||||||
return -1;
|
goto out;
|
||||||
(void) memcpy(el->el_map.help, el_func_help,
|
(void) memcpy(el->el_map.help, el_func_help,
|
||||||
sizeof(*el->el_map.help) * EL_NUM_FCNS);
|
sizeof(*el->el_map.help) * EL_NUM_FCNS);
|
||||||
el->el_map.func = el_calloc(EL_NUM_FCNS, sizeof(*el->el_map.func));
|
el->el_map.func = el_calloc(EL_NUM_FCNS, sizeof(*el->el_map.func));
|
||||||
if (el->el_map.func == NULL)
|
if (el->el_map.func == NULL)
|
||||||
return -1;
|
goto out;
|
||||||
memcpy(el->el_map.func, el_func, sizeof(*el->el_map.func)
|
memcpy(el->el_map.func, el_func, sizeof(*el->el_map.func)
|
||||||
* EL_NUM_FCNS);
|
* EL_NUM_FCNS);
|
||||||
el->el_map.nfunc = EL_NUM_FCNS;
|
el->el_map.nfunc = EL_NUM_FCNS;
|
||||||
@ -940,6 +940,9 @@ map_init(EditLine *el)
|
|||||||
map_init_emacs(el);
|
map_init_emacs(el);
|
||||||
#endif /* VIDEFAULT */
|
#endif /* VIDEFAULT */
|
||||||
return 0;
|
return 0;
|
||||||
|
out:
|
||||||
|
map_end(el);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
25
read.c
25
read.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: read.c,v 1.107 2021/08/15 10:08:41 christos Exp $ */
|
/* $NetBSD: read.c,v 1.108 2022/10/30 19:11:31 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: read.c,v 1.107 2021/08/15 10:08:41 christos Exp $");
|
__RCSID("$NetBSD: read.c,v 1.108 2022/10/30 19:11:31 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -89,28 +89,31 @@ read_init(EditLine *el)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ma = &el->el_read->macros;
|
ma = &el->el_read->macros;
|
||||||
if ((ma->macro = el_calloc(EL_MAXMACRO, sizeof(*ma->macro))) == NULL) {
|
if ((ma->macro = el_calloc(EL_MAXMACRO, sizeof(*ma->macro))) == NULL)
|
||||||
free(el->el_read);
|
goto out;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ma->level = -1;
|
ma->level = -1;
|
||||||
ma->offset = 0;
|
ma->offset = 0;
|
||||||
|
|
||||||
/* builtin read_char */
|
/* builtin read_char */
|
||||||
el->el_read->read_char = read_char;
|
el->el_read->read_char = read_char;
|
||||||
return 0;
|
return 0;
|
||||||
|
out:
|
||||||
|
read_end(el);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* el_read_end():
|
/* el_read_end():
|
||||||
* Free the data structures used by the read stuff.
|
* Free the data structures used by the read stuff.
|
||||||
*/
|
*/
|
||||||
libedit_private void
|
libedit_private void
|
||||||
read_end(struct el_read_t *el_read)
|
read_end(EditLine *el)
|
||||||
{
|
{
|
||||||
read_clearmacros(&el_read->macros);
|
|
||||||
el_free(el_read->macros.macro);
|
read_clearmacros(&el->el_read->macros);
|
||||||
el_read->macros.macro = NULL;
|
el_free(el->el_read->macros.macro);
|
||||||
el_free(el_read);
|
el->el_read->macros.macro = NULL;
|
||||||
|
el_free(el->el_read);
|
||||||
|
el->el_read = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* el_read_setfn():
|
/* el_read_setfn():
|
||||||
|
4
read.h
4
read.h
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: read.h,v 1.12 2016/05/22 19:44:26 christos Exp $ */
|
/* $NetBSD: read.h,v 1.13 2022/10/30 19:11:31 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||||
@ -36,7 +36,7 @@
|
|||||||
#define _h_el_read
|
#define _h_el_read
|
||||||
|
|
||||||
libedit_private int read_init(EditLine *);
|
libedit_private int read_init(EditLine *);
|
||||||
libedit_private void read_end(struct el_read_t *);
|
libedit_private void read_end(EditLine *);
|
||||||
libedit_private void read_prepare(EditLine *);
|
libedit_private void read_prepare(EditLine *);
|
||||||
libedit_private void read_finish(EditLine *);
|
libedit_private void read_finish(EditLine *);
|
||||||
libedit_private int el_read_setfn(struct el_read_t *, el_rfunc_t);
|
libedit_private int el_read_setfn(struct el_read_t *, el_rfunc_t);
|
||||||
|
16
readline.c
16
readline.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: readline.c,v 1.174 2022/04/08 20:11:31 christos Exp $ */
|
/* $NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#if !defined(lint) && !defined(SCCSID)
|
#if !defined(lint) && !defined(SCCSID)
|
||||||
__RCSID("$NetBSD: readline.c,v 1.174 2022/04/08 20:11:31 christos Exp $");
|
__RCSID("$NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $");
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -240,7 +240,7 @@ _default_history_file(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
len = strlen(p->pw_dir) + sizeof("/.history");
|
len = strlen(p->pw_dir) + sizeof("/.history");
|
||||||
if ((path = malloc(len)) == NULL)
|
if ((path = el_malloc(len)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
(void)snprintf(path, len, "%s/.history", p->pw_dir);
|
(void)snprintf(path, len, "%s/.history", p->pw_dir);
|
||||||
@ -478,10 +478,14 @@ readline(const char *p)
|
|||||||
ret = el_gets(e, &count);
|
ret = el_gets(e, &count);
|
||||||
|
|
||||||
if (ret && count > 0) {
|
if (ret && count > 0) {
|
||||||
|
int lastidx;
|
||||||
|
|
||||||
buf = strdup(ret);
|
buf = strdup(ret);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
buf[strcspn(buf, "\n")] = '\0';
|
lastidx = count - 1;
|
||||||
|
if (buf[lastidx] == '\n')
|
||||||
|
buf[lastidx] = '\0';
|
||||||
} else
|
} else
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
|
|
||||||
@ -1602,7 +1606,7 @@ replace_history_entry(int num, const char *line, histdata_t data)
|
|||||||
if (history(h, &ev, H_NEXT_EVDATA, num, &he->data))
|
if (history(h, &ev, H_NEXT_EVDATA, num, &he->data))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
he->line = strdup(ev.str);
|
he->line = ev.str;
|
||||||
if (he->line == NULL)
|
if (he->line == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -2327,6 +2331,8 @@ rl_copy_text(int from, int to)
|
|||||||
|
|
||||||
len = (size_t)(to - from);
|
len = (size_t)(to - from);
|
||||||
out = el_malloc((size_t)len + 1);
|
out = el_malloc((size_t)len + 1);
|
||||||
|
if (out == NULL)
|
||||||
|
return NULL;
|
||||||
(void)strlcpy(out, li->buffer + from , len);
|
(void)strlcpy(out, li->buffer + from , len);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
8
sig.c
8
sig.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: sig.c,v 1.26 2016/05/09 21:46:56 christos Exp $ */
|
/* $NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: sig.c,v 1.26 2016/05/09 21:46:56 christos Exp $");
|
__RCSID("$NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -170,6 +170,7 @@ sig_set(EditLine *el)
|
|||||||
nsa.sa_flags = 0;
|
nsa.sa_flags = 0;
|
||||||
sigemptyset(&nsa.sa_mask);
|
sigemptyset(&nsa.sa_mask);
|
||||||
|
|
||||||
|
sel = el;
|
||||||
(void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
|
(void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
|
||||||
|
|
||||||
for (i = 0; sighdl[i] != -1; i++) {
|
for (i = 0; sighdl[i] != -1; i++) {
|
||||||
@ -178,7 +179,6 @@ sig_set(EditLine *el)
|
|||||||
osa.sa_handler != sig_handler)
|
osa.sa_handler != sig_handler)
|
||||||
el->el_signal->sig_action[i] = osa;
|
el->el_signal->sig_action[i] = osa;
|
||||||
}
|
}
|
||||||
sel = el;
|
|
||||||
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,5 @@ sig_clr(EditLine *el)
|
|||||||
(void)sigaction(sighdl[i],
|
(void)sigaction(sighdl[i],
|
||||||
&el->el_signal->sig_action[i], NULL);
|
&el->el_signal->sig_action[i], NULL);
|
||||||
|
|
||||||
sel = NULL; /* we are going to die if the handler is
|
|
||||||
* called */
|
|
||||||
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||||
}
|
}
|
||||||
|
40
sys.h
40
sys.h
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: sys.h,v 1.27 2016/05/09 21:46:56 christos Exp $ */
|
/* $NetBSD: sys.h,v 1.28 2023/02/04 14:34:28 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -65,49 +65,11 @@
|
|||||||
# define __arraycount(a) (sizeof(a) / sizeof(*(a)))
|
# define __arraycount(a) (sizeof(a) / sizeof(*(a)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLCAT
|
|
||||||
#define strlcat libedit_strlcat
|
|
||||||
size_t strlcat(char *dst, const char *src, size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
|
||||||
#define strlcpy libedit_strlcpy
|
|
||||||
size_t strlcpy(char *dst, const char *src, size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_GETLINE
|
|
||||||
#define getline libedit_getline
|
|
||||||
ssize_t getline(char **line, size_t *len, FILE *fp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _DIAGASSERT
|
|
||||||
#define _DIAGASSERT(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __RCSID
|
#ifndef __RCSID
|
||||||
#define __RCSID(x)
|
#define __RCSID(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_U_INT32_T
|
|
||||||
typedef unsigned int u_int32_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_SIZE_MAX
|
|
||||||
#define SIZE_MAX ((size_t)-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define REGEX /* Use POSIX.2 regular expression functions */
|
#define REGEX /* Use POSIX.2 regular expression functions */
|
||||||
#undef REGEXP /* Use UNIX V8 regular expression functions */
|
#undef REGEXP /* Use UNIX V8 regular expression functions */
|
||||||
|
|
||||||
#if defined(__sun)
|
|
||||||
extern int tgetent(char *, const char *);
|
|
||||||
extern int tgetflag(char *);
|
|
||||||
extern int tgetnum(char *);
|
|
||||||
extern int tputs(const char *, int, int (*)(int));
|
|
||||||
extern char* tgoto(const char*, int, int);
|
|
||||||
extern char* tgetstr(char*, char**);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _h_sys */
|
#endif /* _h_sys */
|
||||||
|
38
terminal.c
38
terminal.c
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: terminal.c,v 1.44 2021/09/09 20:24:07 christos Exp $ */
|
/* $NetBSD: terminal.c,v 1.46 2023/02/04 14:34:28 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
|
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: terminal.c,v 1.44 2021/09/09 20:24:07 christos Exp $");
|
__RCSID("$NetBSD: terminal.c,v 1.46 2023/02/04 14:34:28 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
@ -68,6 +68,15 @@ __RCSID("$NetBSD: terminal.c,v 1.44 2021/09/09 20:24:07 christos Exp $");
|
|||||||
#include <term.h>
|
#include <term.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__sun)
|
||||||
|
extern int tgetent(char *, const char *);
|
||||||
|
extern int tgetflag(char *);
|
||||||
|
extern int tgetnum(char *);
|
||||||
|
extern int tputs(const char *, int, int (*)(int));
|
||||||
|
extern char* tgoto(const char*, int, int);
|
||||||
|
extern char* tgetstr(char*, char**);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _REENTRANT
|
#ifdef _REENTRANT
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
@ -272,40 +281,29 @@ terminal_init(EditLine *el)
|
|||||||
el->el_terminal.t_buf = el_calloc(TC_BUFSIZE,
|
el->el_terminal.t_buf = el_calloc(TC_BUFSIZE,
|
||||||
sizeof(*el->el_terminal.t_buf));
|
sizeof(*el->el_terminal.t_buf));
|
||||||
if (el->el_terminal.t_buf == NULL)
|
if (el->el_terminal.t_buf == NULL)
|
||||||
goto fail1;
|
return -1;
|
||||||
el->el_terminal.t_cap = el_calloc(TC_BUFSIZE,
|
el->el_terminal.t_cap = el_calloc(TC_BUFSIZE,
|
||||||
sizeof(*el->el_terminal.t_cap));
|
sizeof(*el->el_terminal.t_cap));
|
||||||
if (el->el_terminal.t_cap == NULL)
|
if (el->el_terminal.t_cap == NULL)
|
||||||
goto fail2;
|
goto out;
|
||||||
el->el_terminal.t_fkey = el_calloc(A_K_NKEYS,
|
el->el_terminal.t_fkey = el_calloc(A_K_NKEYS,
|
||||||
sizeof(*el->el_terminal.t_fkey));
|
sizeof(*el->el_terminal.t_fkey));
|
||||||
if (el->el_terminal.t_fkey == NULL)
|
if (el->el_terminal.t_fkey == NULL)
|
||||||
goto fail3;
|
goto out;
|
||||||
el->el_terminal.t_loc = 0;
|
el->el_terminal.t_loc = 0;
|
||||||
el->el_terminal.t_str = el_calloc(T_str,
|
el->el_terminal.t_str = el_calloc(T_str,
|
||||||
sizeof(*el->el_terminal.t_str));
|
sizeof(*el->el_terminal.t_str));
|
||||||
if (el->el_terminal.t_str == NULL)
|
if (el->el_terminal.t_str == NULL)
|
||||||
goto fail4;
|
goto out;
|
||||||
el->el_terminal.t_val = el_calloc(T_val,
|
el->el_terminal.t_val = el_calloc(T_val,
|
||||||
sizeof(*el->el_terminal.t_val));
|
sizeof(*el->el_terminal.t_val));
|
||||||
if (el->el_terminal.t_val == NULL)
|
if (el->el_terminal.t_val == NULL)
|
||||||
goto fail5;
|
goto out;
|
||||||
(void) terminal_set(el, NULL);
|
(void) terminal_set(el, NULL);
|
||||||
terminal_init_arrow(el);
|
terminal_init_arrow(el);
|
||||||
return 0;
|
return 0;
|
||||||
fail5:
|
out:
|
||||||
free(el->el_terminal.t_str);
|
terminal_end(el);
|
||||||
el->el_terminal.t_str = NULL;
|
|
||||||
fail4:
|
|
||||||
free(el->el_terminal.t_fkey);
|
|
||||||
el->el_terminal.t_fkey = NULL;
|
|
||||||
fail3:
|
|
||||||
free(el->el_terminal.t_cap);
|
|
||||||
el->el_terminal.t_cap = NULL;
|
|
||||||
fail2:
|
|
||||||
free(el->el_terminal.t_buf);
|
|
||||||
el->el_terminal.t_buf = NULL;
|
|
||||||
fail1:
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user