mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
libedit: import vendor snapshort 2025-01-03
This commit is contained in:
commit
136d69caf0
26 changed files with 350 additions and 98 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.66 2019/10/13 07:28:10 mrg Exp $
|
||||
# $NetBSD: Makefile,v 1.70 2023/08/03 14:56:36 rin Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/4/93
|
||||
|
||||
USE_SHLIBDIR= yes
|
||||
|
|
@ -21,6 +21,12 @@ SRCS = chared.c chartype.c common.c el.c eln.c emacs.c filecomplete.c \
|
|||
|
||||
MAN= editline.3 editrc.5 editline.7
|
||||
|
||||
FILES+= libedit.pc
|
||||
FILESOWN_libedit.pc= ${BINOWN}
|
||||
FILESGRP_libedit.pc= ${BINGRP}
|
||||
FILESMODE_libedit.pc= ${NONBINMODE}
|
||||
FILESDIR_libedit.pc= /usr/lib/pkgconfig
|
||||
|
||||
MLINKS= \
|
||||
editline.3 el_deletestr.3 \
|
||||
editline.3 el_end.3 \
|
||||
|
|
@ -138,6 +144,6 @@ COPTS.tokenizer.c+= -Wno-cast-qual
|
|||
COPTS.tokenizern.c+= -Wno-cast-qual
|
||||
.endif
|
||||
|
||||
COPTS.history.c+= ${GCC_NO_STRINGOP_OVERFLOW}
|
||||
COPTS.historyn.c+= ${GCC_NO_STRINGOP_OVERFLOW}
|
||||
COPTS.readline.c+= ${GCC_NO_STRINGOP_TRUNCATION} ${GCC_NO_STRINGOP_OVERFLOW}
|
||||
COPTS.history.c+= ${CC_WNO_STRINGOP_OVERFLOW}
|
||||
COPTS.historyn.c+= ${CC_WNO_STRINGOP_OVERFLOW}
|
||||
COPTS.readline.c+= ${CC_WNO_STRINGOP_TRUNCATION} ${CC_WNO_STRINGOP_OVERFLOW}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chared.c,v 1.63 2022/10/30 19:11:31 christos Exp $ */
|
||||
/* $NetBSD: chared.c,v 1.64 2024/06/29 14:13:14 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: chared.c,v 1.63 2022/10/30 19:11:31 christos Exp $");
|
||||
__RCSID("$NetBSD: chared.c,v 1.64 2024/06/29 14:13:14 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -319,6 +319,8 @@ cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t))
|
|||
test = (*wtest)(*p);
|
||||
while ((p >= low) && (*wtest)(*p) == test)
|
||||
p--;
|
||||
if (p < low)
|
||||
return low;
|
||||
}
|
||||
p++;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chartype.c,v 1.36 2022/10/30 19:11:31 christos Exp $ */
|
||||
/* $NetBSD: chartype.c,v 1.37 2023/08/10 20:38:00 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: chartype.c,v 1.36 2022/10/30 19:11:31 christos Exp $");
|
||||
__RCSID("$NetBSD: chartype.c,v 1.37 2023/08/10 20:38:00 mrg Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <ctype.h>
|
||||
|
|
@ -235,17 +235,17 @@ ct_visual_string(const wchar_t *s, ct_buffer_t *conv)
|
|||
}
|
||||
|
||||
/* failed to encode, need more buffer space */
|
||||
used = dst - conv->wbuff;
|
||||
uintptr_t sused = (uintptr_t)dst - (uintptr_t)conv->wbuff;
|
||||
if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1)
|
||||
return NULL;
|
||||
dst = conv->wbuff + used;
|
||||
dst = conv->wbuff + sused;
|
||||
}
|
||||
|
||||
if (dst >= (conv->wbuff + conv->wsize)) { /* sigh */
|
||||
used = dst - conv->wbuff;
|
||||
uintptr_t sused = (uintptr_t)dst - (uintptr_t)conv->wbuff;
|
||||
if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1)
|
||||
return NULL;
|
||||
dst = conv->wbuff + used;
|
||||
dst = conv->wbuff + sused;
|
||||
}
|
||||
|
||||
*dst = L'\0';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $ */
|
||||
/* $NetBSD: common.c,v 1.50 2024/06/30 16:29:42 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $");
|
||||
__RCSID("$NetBSD: common.c,v 1.50 2024/06/30 16:29:42 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -222,7 +222,8 @@ ed_move_to_end(EditLine *el, wint_t c __attribute__((__unused__)))
|
|||
return CC_REFRESH;
|
||||
}
|
||||
#ifdef VI_MOVE
|
||||
el->el_line.cursor--;
|
||||
if (el->el_line.cursor > el->el_line.buffer)
|
||||
el->el_line.cursor--;
|
||||
#endif
|
||||
}
|
||||
return CC_CURSOR;
|
||||
|
|
|
|||
204
contrib/libedit/edit.expsym
Normal file
204
contrib/libedit/edit.expsym
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
_el_fn_complete
|
||||
_el_fn_sh_complete
|
||||
_rl_abort_internal
|
||||
_rl_complete_mark_directories
|
||||
_rl_completion_prefix_display_length
|
||||
_rl_echoing_p
|
||||
_rl_erase_entire_line
|
||||
_rl_print_completions_horizontally
|
||||
_rl_qsort_string_compare
|
||||
add_history
|
||||
append_history
|
||||
clear_history
|
||||
completion_matches
|
||||
ct_decode_string
|
||||
ct_encode_string
|
||||
current_history
|
||||
el_beep
|
||||
el_cursor
|
||||
el_deletestr
|
||||
el_deletestr1
|
||||
el_end
|
||||
el_get
|
||||
el_getc
|
||||
el_gets
|
||||
el_init
|
||||
el_init_fd
|
||||
el_insertstr
|
||||
el_line
|
||||
el_parse
|
||||
el_push
|
||||
el_replacestr
|
||||
el_reset
|
||||
el_resize
|
||||
el_set
|
||||
el_source
|
||||
el_wget
|
||||
el_wgetc
|
||||
el_wgets
|
||||
el_winsertstr
|
||||
el_wline
|
||||
el_wparse
|
||||
el_wpush
|
||||
el_wreplacestr
|
||||
el_wset
|
||||
emacs_ctlx_keymap
|
||||
emacs_meta_keymap
|
||||
emacs_standard_keymap
|
||||
filename_completion_function
|
||||
fn_complete
|
||||
fn_complete2
|
||||
fn_display_match_list
|
||||
fn_filename_completion_function
|
||||
fn_tilde_expand
|
||||
free_history_entry
|
||||
get_history_event
|
||||
history
|
||||
history_arg_extract
|
||||
history_base
|
||||
history_end
|
||||
history_expand
|
||||
history_expansion_char
|
||||
history_get
|
||||
history_get_history_state
|
||||
history_inhibit_expansion_function
|
||||
history_init
|
||||
history_is_stifled
|
||||
history_length
|
||||
history_list
|
||||
history_max_entries
|
||||
history_no_expand_chars
|
||||
history_offset
|
||||
history_search
|
||||
history_search_pos
|
||||
history_search_prefix
|
||||
history_set_pos
|
||||
history_subst_char
|
||||
history_tokenize
|
||||
history_total_bytes
|
||||
history_truncate_file
|
||||
history_w
|
||||
history_wend
|
||||
history_winit
|
||||
max_input_history
|
||||
next_history
|
||||
previous_history
|
||||
read_history
|
||||
readline
|
||||
readline_echoing_p
|
||||
remove_history
|
||||
replace_history_entry
|
||||
rl_abort
|
||||
rl_add_defun
|
||||
rl_already_prompted
|
||||
rl_attempted_completion_function
|
||||
rl_attempted_completion_over
|
||||
rl_basic_quote_characters
|
||||
rl_basic_word_break_characters
|
||||
rl_bind_key
|
||||
rl_bind_key_in_map
|
||||
rl_callback_handler_install
|
||||
rl_callback_handler_remove
|
||||
rl_callback_read_char
|
||||
rl_catch_signals
|
||||
rl_catch_sigwinch
|
||||
rl_cleanup_after_signal
|
||||
rl_complete
|
||||
rl_completer_quote_characters
|
||||
rl_completer_word_break_characters
|
||||
rl_completion_append_character
|
||||
rl_completion_display_matches_hook
|
||||
rl_completion_entry_function
|
||||
rl_completion_matches
|
||||
rl_completion_query_items
|
||||
rl_completion_suppress_append
|
||||
rl_completion_type
|
||||
rl_completion_word_break_hook
|
||||
rl_copy_text
|
||||
rl_crlf
|
||||
rl_delete_text
|
||||
rl_deprep_term_function
|
||||
rl_deprep_terminal
|
||||
rl_ding
|
||||
rl_directory_completion_hook
|
||||
rl_display_match_list
|
||||
rl_display_prompt
|
||||
rl_done
|
||||
rl_echo_signal_char
|
||||
rl_end
|
||||
rl_erase_empty_line
|
||||
rl_event_hook
|
||||
rl_filename_completion_desired
|
||||
rl_filename_completion_function
|
||||
rl_forced_update_display
|
||||
rl_free_line_state
|
||||
rl_generic_bind
|
||||
rl_get_keymap
|
||||
rl_get_previous_history
|
||||
rl_get_screen_size
|
||||
rl_getc_function
|
||||
rl_ignore_completion_duplicates
|
||||
rl_inhibit_completion
|
||||
rl_initialize
|
||||
rl_insert
|
||||
rl_insert_text
|
||||
rl_instream
|
||||
rl_kill_text
|
||||
rl_library_version
|
||||
rl_line_buffer
|
||||
rl_linefunc
|
||||
rl_make_bare_keymap
|
||||
rl_message
|
||||
rl_newline
|
||||
rl_on_new_line
|
||||
rl_outstream
|
||||
rl_parse_and_bind
|
||||
rl_point
|
||||
rl_pre_input_hook
|
||||
rl_prep_term_function
|
||||
rl_prep_terminal
|
||||
rl_prompt
|
||||
rl_prompt_saved
|
||||
rl_read_init_file
|
||||
rl_read_key
|
||||
rl_readline_name
|
||||
rl_readline_state
|
||||
rl_readline_version
|
||||
rl_redisplay
|
||||
rl_redisplay_function
|
||||
rl_replace_line
|
||||
rl_reset_after_signal
|
||||
rl_reset_terminal
|
||||
rl_resize_terminal
|
||||
rl_restore_prompt
|
||||
rl_save_prompt
|
||||
rl_set_key
|
||||
rl_set_keyboard_input_timeout
|
||||
rl_set_keymap
|
||||
rl_set_keymap_name
|
||||
rl_set_prompt
|
||||
rl_set_screen_size
|
||||
rl_sort_completion_matches
|
||||
rl_special_prefixes
|
||||
rl_startup1_hook
|
||||
rl_startup_hook
|
||||
rl_stuff_char
|
||||
rl_terminal_name
|
||||
rl_variable_bind
|
||||
stifle_history
|
||||
tilde_expand
|
||||
tok_end
|
||||
tok_init
|
||||
tok_line
|
||||
tok_reset
|
||||
tok_str
|
||||
tok_wend
|
||||
tok_winit
|
||||
tok_wline
|
||||
tok_wreset
|
||||
tok_wstr
|
||||
unstifle_history
|
||||
username_completion_function
|
||||
using_history
|
||||
where_history
|
||||
write_history
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: editline.3,v 1.101 2021/08/15 10:12:54 wiz Exp $
|
||||
.\" $NetBSD: editline.3,v 1.102 2024/02/04 18:47:27 andvar Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2014 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
|
@ -512,7 +512,7 @@ If the
|
|||
.Fa flag
|
||||
argument is non-zero, then
|
||||
.Nm editline
|
||||
attempts to recover from read errors, ignoring the first interrrupted
|
||||
attempts to recover from read errors, ignoring the first interrupted
|
||||
error, and trying to reset the input file descriptor to reset non-blocking I/O.
|
||||
This is disabled by default, and desirable only when
|
||||
.Nm editline
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: editline.7,v 1.5 2016/05/09 21:27:55 christos Exp $
|
||||
.\" $NetBSD: editline.7,v 1.6 2024/04/06 13:36:11 christos Exp $
|
||||
.\" $OpenBSD: editline.7,v 1.1 2016/04/20 01:11:45 schwarze Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd May 7, 2016
|
||||
.Dd April 6, 2024
|
||||
.Dt EDITLINE 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -546,7 +546,7 @@ It is an error if the cursor is already at the end of the edit
|
|||
buffer.
|
||||
.It Ic em-set-mark Pq emacs: Ctrl-Q, NUL
|
||||
Set the mark at the current cursor position.
|
||||
.It Ic em-toggle-overwrite Pq not bound by default
|
||||
.It Ic em-toggle-overwrite Pq insert
|
||||
Switch from insert to overwrite mode or vice versa.
|
||||
.It Ic em-universal-argument Pq not bound by default
|
||||
If in argument input mode, multiply the argument by 4.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: el.c,v 1.101 2022/10/30 19:11:31 christos Exp $ */
|
||||
/* $NetBSD: el.c,v 1.102 2025/01/03 00:40:08 rillig 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.101 2022/10/30 19:11:31 christos Exp $");
|
||||
__RCSID("$NetBSD: el.c,v 1.102 2025/01/03 00:40:08 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -274,7 +274,6 @@ el_wset(EditLine *el, int op, ...)
|
|||
default:
|
||||
rv = -1;
|
||||
EL_ABORT((el->el_errfile, "Bad op %d\n", op));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: el.h,v 1.46 2021/08/15 10:08:41 christos Exp $ */
|
||||
/* $NetBSD: el.h,v 1.48 2025/01/03 00:40:08 rillig Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -58,6 +58,7 @@
|
|||
#define NARROW_HISTORY 0x040
|
||||
#define NO_RESET 0x080
|
||||
#define FIXIO 0x100
|
||||
#define FROM_ELLINE 0x200
|
||||
|
||||
typedef unsigned char el_action_t; /* Index to command array */
|
||||
|
||||
|
|
@ -152,7 +153,7 @@ libedit_private EditLine *el_init_internal(const char *, FILE *, FILE *,
|
|||
__FILE__, __LINE__); \
|
||||
fprintf a; \
|
||||
abort(); \
|
||||
} while( /*CONSTCOND*/0);
|
||||
} while (0)
|
||||
#else
|
||||
#define EL_ABORT(a) abort()
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: eln.c,v 1.37 2022/01/11 18:30:15 christos Exp $ */
|
||||
/* $NetBSD: eln.c,v 1.38 2024/05/17 02:59:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: eln.c,v 1.37 2022/01/11 18:30:15 christos Exp $");
|
||||
__RCSID("$NetBSD: eln.c,v 1.38 2024/05/17 02:59:08 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <errno.h>
|
||||
|
|
@ -365,6 +365,10 @@ el_line(EditLine *el)
|
|||
size_t offset;
|
||||
const wchar_t *p;
|
||||
|
||||
if (el->el_flags & FROM_ELLINE)
|
||||
return info;
|
||||
|
||||
el->el_flags |= FROM_ELLINE;
|
||||
info->buffer = ct_encode_string(winfo->buffer, &el->el_lgcyconv);
|
||||
|
||||
offset = 0;
|
||||
|
|
@ -377,6 +381,10 @@ el_line(EditLine *el)
|
|||
offset += ct_enc_width(*p);
|
||||
info->lastchar = info->buffer + offset;
|
||||
|
||||
if (el->el_chared.c_resizefun)
|
||||
(*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg);
|
||||
el->el_flags &= ~FROM_ELLINE;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: emacs.c,v 1.36 2016/05/09 21:46:56 christos Exp $ */
|
||||
/* $NetBSD: emacs.c,v 1.38 2024/06/29 17:28:07 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: emacs.c,v 1.36 2016/05/09 21:46:56 christos Exp $");
|
||||
__RCSID("$NetBSD: emacs.c,v 1.38 2024/06/29 17:28:07 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -134,11 +134,11 @@ em_yank(EditLine *el, wint_t c __attribute__((__unused__)))
|
|||
return CC_ERROR;
|
||||
|
||||
el->el_chared.c_kill.mark = el->el_line.cursor;
|
||||
cp = el->el_line.cursor;
|
||||
|
||||
/* open the space, */
|
||||
c_insert(el,
|
||||
(int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf));
|
||||
cp = el->el_line.cursor;
|
||||
/* copy the chars */
|
||||
for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++)
|
||||
*cp++ = *kp;
|
||||
|
|
@ -448,12 +448,12 @@ em_copy_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
|
|||
if (el->el_line.cursor == el->el_line.buffer)
|
||||
return CC_ERROR;
|
||||
|
||||
oldc = el->el_line.cursor;
|
||||
/* does a bounds check */
|
||||
cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
|
||||
el->el_state.argument, ce__isword);
|
||||
|
||||
c_insert(el, (int)(oldc - cp));
|
||||
c_insert(el, (int)(el->el_line.cursor - cp));
|
||||
oldc = el->el_line.cursor;
|
||||
for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++)
|
||||
*dp++ = *cp;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filecomplete.c,v 1.72 2023/02/03 22:01:42 christos Exp $ */
|
||||
/* $NetBSD: filecomplete.c,v 1.73 2023/04/25 17:51:32 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: filecomplete.c,v 1.72 2023/02/03 22:01:42 christos Exp $");
|
||||
__RCSID("$NetBSD: filecomplete.c,v 1.73 2023/04/25 17:51:32 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
@ -459,11 +459,11 @@ out:
|
|||
el_free(expname);
|
||||
return rs;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns list of completions for text given
|
||||
* non-static for readline.
|
||||
*/
|
||||
char ** completion_matches(const char *, char *(*)(const char *, int));
|
||||
char **
|
||||
completion_matches(const char *text, char *(*genfunc)(const char *, int))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filecomplete.h,v 1.14 2021/09/26 13:45:54 christos Exp $ */
|
||||
/* $NetBSD: filecomplete.h,v 1.15 2023/04/25 17:51:32 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
|
@ -48,4 +48,7 @@ void fn_display_match_list(EditLine *, char **, size_t, size_t,
|
|||
char *fn_tilde_expand(const char *);
|
||||
char *fn_filename_completion_function(const char *, int);
|
||||
|
||||
/* XXX: readline */
|
||||
char **completion_matches(const char *, char *(*)(const char *, int));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $ */
|
||||
/* $NetBSD: history.c,v 1.64 2024/07/11 05:41:24 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $");
|
||||
__RCSID("$NetBSD: history.c,v 1.64 2024/07/11 05:41:24 kre Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -45,6 +45,7 @@ __RCSID("$NetBSD: history.c,v 1.63 2019/10/08 19:17:57 christos Exp $");
|
|||
* hist.c: TYPE(History) access functions
|
||||
*/
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -842,8 +843,6 @@ history_save_fp(TYPE(History) *h, size_t nelem, FILE *fp)
|
|||
static ct_buffer_t conv;
|
||||
#endif
|
||||
|
||||
if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
|
||||
goto done;
|
||||
if (ftell(fp) == 0 && fputs(hist_cookie, fp) == EOF)
|
||||
goto done;
|
||||
ptr = h_malloc((max_size = 1024) * sizeof(*ptr));
|
||||
|
|
@ -891,7 +890,11 @@ history_save(TYPE(History) *h, const char *fname)
|
|||
FILE *fp;
|
||||
int i;
|
||||
|
||||
if ((fp = fopen(fname, "w")) == NULL)
|
||||
if ((i = open(fname, O_WRONLY|O_CREAT|O_TRUNC,
|
||||
S_IRUSR|S_IWUSR)) == -1)
|
||||
return -1;
|
||||
|
||||
if ((fp = fdopen(i, "w")) == NULL)
|
||||
return -1;
|
||||
|
||||
i = history_save_fp(h, (size_t)-1, fp);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: keymacro.c,v 1.24 2019/07/23 10:18:52 christos Exp $ */
|
||||
/* $NetBSD: keymacro.c,v 1.25 2025/01/03 00:40:08 rillig Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: keymacro.c,v 1.24 2019/07/23 10:18:52 christos Exp $");
|
||||
__RCSID("$NetBSD: keymacro.c,v 1.25 2025/01/03 00:40:08 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -346,7 +346,6 @@ node__try(EditLine *el, keymacro_node_t *ptr, const wchar_t *str,
|
|||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type %d\n",
|
||||
ptr->type));
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ptr->type = ntype) {
|
||||
|
|
@ -359,7 +358,6 @@ node__try(EditLine *el, keymacro_node_t *ptr, const wchar_t *str,
|
|||
break;
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* still more chars to go */
|
||||
|
|
@ -444,7 +442,6 @@ node__put(EditLine *el, keymacro_node_t *ptr)
|
|||
break;
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type));
|
||||
break;
|
||||
}
|
||||
el_free(ptr);
|
||||
}
|
||||
|
|
@ -614,7 +611,6 @@ keymacro_kprint(EditLine *el, const wchar_t *key, keymacro_value_t *val,
|
|||
break;
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
|
||||
break;
|
||||
}
|
||||
else
|
||||
(void) fprintf(el->el_outfile, fmt, ct_encode_string(key,
|
||||
|
|
|
|||
12
contrib/libedit/libedit.pc
Normal file
12
contrib/libedit/libedit.pc
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: libedit
|
||||
Description: command line editor library providing generic line editing, history, and tokenization functions.
|
||||
Version: 3.1
|
||||
Requires:
|
||||
Libs: -Wl,-R${libdir} -L${libdir} -ledit
|
||||
Libs.private: -ltermcap
|
||||
Cflags: -I${includedir} -I${includedir}/readline
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: literal.c,v 1.5 2019/07/23 13:10:11 christos Exp $ */
|
||||
/* $NetBSD: literal.c,v 1.6 2024/12/05 22:21:53 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2017 The NetBSD Foundation, Inc.
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: literal.c,v 1.5 2019/07/23 13:10:11 christos Exp $");
|
||||
__RCSID("$NetBSD: literal.c,v 1.6 2024/12/05 22:21:53 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
|
|
@ -85,7 +85,7 @@ literal_add(EditLine *el, const wchar_t *buf, const wchar_t *end, int *wp)
|
|||
w = wcwidth(end[1]); /* column width of the visible char */
|
||||
*wp = (int)w;
|
||||
|
||||
if (w <= 0) /* we require something to be printed */
|
||||
if (w < 0) /* non-printable characters are negative */
|
||||
return 0;
|
||||
|
||||
len = (size_t)(end - buf);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: map.c,v 1.55 2022/10/30 19:11:31 christos Exp $ */
|
||||
/* $NetBSD: map.c,v 1.56 2025/01/03 00:40:08 rillig Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: map.c,v 1.55 2022/10/30 19:11:31 christos Exp $");
|
||||
__RCSID("$NetBSD: map.c,v 1.56 2025/01/03 00:40:08 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -1390,7 +1390,6 @@ map_bind(EditLine *el, int argc, const wchar_t **argv)
|
|||
/* coverity[dead_error_begin] */
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: read.c,v 1.108 2022/10/30 19:11:31 christos Exp $ */
|
||||
/* $NetBSD: read.c,v 1.109 2025/01/03 00:40:08 rillig Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: read.c,v 1.108 2022/10/30 19:11:31 christos Exp $");
|
||||
__RCSID("$NetBSD: read.c,v 1.109 2025/01/03 00:40:08 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -265,7 +265,6 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, wchar_t *ch)
|
|||
return -1;
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type \n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (cmd == ED_SEQUENCE_LEAD_IN);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $ */
|
||||
/* $NetBSD: readline.c,v 1.182 2024/03/26 18:02:04 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $");
|
||||
__RCSID("$NetBSD: readline.c,v 1.182 2024/03/26 18:02:04 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
@ -51,7 +51,9 @@ __RCSID("$NetBSD: readline.c,v 1.178 2022/12/02 19:23:15 christos Exp $");
|
|||
#include <unistd.h>
|
||||
#include <vis.h>
|
||||
|
||||
#define completion_matches xxx_completion_matches
|
||||
#include "readline/readline.h"
|
||||
#undef completion_matches
|
||||
#include "el.h"
|
||||
#include "fcns.h"
|
||||
#include "filecomplete.h"
|
||||
|
|
@ -101,7 +103,7 @@ int max_input_history = 0;
|
|||
char history_expansion_char = '!';
|
||||
char history_subst_char = '^';
|
||||
char *history_no_expand_chars = expand_chars;
|
||||
Function *history_inhibit_expansion_function = NULL;
|
||||
rl_linebuf_func_t *history_inhibit_expansion_function = NULL;
|
||||
char *history_arg_extract(int start, int end, const char *str);
|
||||
|
||||
int rl_inhibit_completion = 0;
|
||||
|
|
@ -122,11 +124,11 @@ int rl_filename_completion_desired = 0;
|
|||
int rl_ignore_completion_duplicates = 0;
|
||||
int readline_echoing_p = 1;
|
||||
int _rl_print_completions_horizontally = 0;
|
||||
VFunction *rl_redisplay_function = NULL;
|
||||
rl_voidfunc_t *rl_redisplay_function = NULL;
|
||||
rl_hook_func_t *rl_startup_hook = NULL;
|
||||
VFunction *rl_completion_display_matches_hook = NULL;
|
||||
VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
|
||||
VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
|
||||
rl_compdisp_func_t *rl_completion_display_matches_hook = NULL;
|
||||
rl_vintfunc_t *rl_prep_term_function = (rl_vintfunc_t *)rl_prep_terminal;
|
||||
rl_voidfunc_t *rl_deprep_term_function = (rl_voidfunc_t *)rl_deprep_terminal;
|
||||
KEYMAP_ENTRY_ARRAY emacs_meta_keymap;
|
||||
unsigned long rl_readline_state = RL_STATE_NONE;
|
||||
int _rl_complete_mark_directories;
|
||||
|
|
@ -400,7 +402,7 @@ rl_initialize(void)
|
|||
* Allow the use of the Delete/Insert keys.
|
||||
*/
|
||||
el_set(e, EL_BIND, "\\e[3~", "ed-delete-next-char", NULL);
|
||||
el_set(e, EL_BIND, "\\e[2~", "ed-quoted-insert", NULL);
|
||||
el_set(e, EL_BIND, "\\e[2~", "em-toggle-overwrite", NULL);
|
||||
|
||||
/*
|
||||
* Ctrl-left-arrow and Ctrl-right-arrow for word moving.
|
||||
|
|
@ -1978,7 +1980,7 @@ rl_complete(int ignore __attribute__((__unused__)), int invoking_key)
|
|||
_rl_update_pos();
|
||||
|
||||
/* Just look at how many global variables modify this operation! */
|
||||
return fn_complete(e,
|
||||
return fn_complete2(e,
|
||||
(rl_compentry_func_t *)rl_completion_entry_function,
|
||||
rl_attempted_completion_function,
|
||||
ct_decode_string(rl_basic_word_break_characters, &wbreak_conv),
|
||||
|
|
@ -1986,7 +1988,7 @@ rl_complete(int ignore __attribute__((__unused__)), int invoking_key)
|
|||
_rl_completion_append_character_function,
|
||||
(size_t)rl_completion_query_items,
|
||||
&rl_completion_type, &rl_attempted_completion_over,
|
||||
&rl_point, &rl_end);
|
||||
&rl_point, &rl_end, 0);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2573,7 +2575,7 @@ void
|
|||
rl_reset_after_signal(void)
|
||||
{
|
||||
if (rl_prep_term_function)
|
||||
(*rl_prep_term_function)();
|
||||
(*rl_prep_term_function)(1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readline.h,v 1.53 2022/02/19 17:45:02 christos Exp $ */
|
||||
/* $NetBSD: readline.h,v 1.55 2023/04/25 17:51:32 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
|
@ -37,12 +37,13 @@
|
|||
/* list of readline stuff supported by editline library's readline wrapper */
|
||||
|
||||
/* typedefs */
|
||||
typedef int Function(const char *, int);
|
||||
typedef char *CPFunction(const char *, int);
|
||||
typedef void VFunction(void);
|
||||
typedef int rl_linebuf_func_t(const char *, int);
|
||||
typedef void rl_voidfunc_t(void);
|
||||
typedef void rl_vintfunc_t(int);
|
||||
typedef void rl_vcpfunc_t(char *);
|
||||
typedef char **rl_completion_func_t(const char *, int, int);
|
||||
typedef char *rl_compentry_func_t(const char *, int);
|
||||
typedef void rl_compdisp_func_t(char **, int, int);
|
||||
typedef int rl_command_func_t(int, int);
|
||||
typedef int rl_hook_func_t(void);
|
||||
typedef int rl_icppfunc_t(char **);
|
||||
|
|
@ -64,7 +65,7 @@ typedef struct _keymap_entry {
|
|||
#define ISFUNC 0
|
||||
#define ISKMAP 1
|
||||
#define ISMACR 2
|
||||
Function *function;
|
||||
rl_linebuf_func_t *function;
|
||||
} KEYMAP_ENTRY;
|
||||
|
||||
#define KEYMAP_SIZE 256
|
||||
|
|
@ -111,9 +112,7 @@ extern const char *rl_readline_name;
|
|||
extern FILE *rl_instream;
|
||||
extern FILE *rl_outstream;
|
||||
extern char *rl_line_buffer;
|
||||
extern int rl_point, rl_end;
|
||||
extern int history_base, history_length;
|
||||
extern int max_input_history;
|
||||
extern int rl_point, rl_end;
|
||||
extern const char *rl_basic_quote_characters;
|
||||
extern const char *rl_basic_word_break_characters;
|
||||
extern char *rl_completer_word_break_characters;
|
||||
|
|
@ -127,12 +126,23 @@ extern int rl_completion_query_items;
|
|||
extern const char *rl_special_prefixes;
|
||||
extern int rl_completion_append_character;
|
||||
extern int rl_inhibit_completion;
|
||||
extern rl_hook_func_t *rl_pre_input_hook;
|
||||
extern rl_hook_func_t *rl_startup_hook;
|
||||
extern rl_hook_func_t *rl_pre_input_hook;
|
||||
extern rl_hook_func_t *rl_startup_hook;
|
||||
extern char *rl_terminal_name;
|
||||
extern int rl_already_prompted;
|
||||
extern char *rl_prompt;
|
||||
extern int rl_done;
|
||||
extern rl_vcpfunc_t *rl_linefunc;
|
||||
extern rl_hook_func_t *rl_startup1_hook;
|
||||
extern char *rl_prompt_saved;
|
||||
extern int history_base, history_length;
|
||||
extern int history_offset;
|
||||
extern char history_expansion_char;
|
||||
extern char history_subst_char;
|
||||
extern char *history_no_expand_chars;
|
||||
extern rl_linebuf_func_t *history_inhibit_expansion_function;
|
||||
extern int max_input_history;
|
||||
|
||||
/*
|
||||
* The following is not implemented
|
||||
*/
|
||||
|
|
@ -145,10 +155,10 @@ extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
|
|||
extern int rl_filename_completion_desired;
|
||||
extern int rl_ignore_completion_duplicates;
|
||||
extern int (*rl_getc_function)(FILE *);
|
||||
extern VFunction *rl_redisplay_function;
|
||||
extern VFunction *rl_completion_display_matches_hook;
|
||||
extern VFunction *rl_prep_term_function;
|
||||
extern VFunction *rl_deprep_term_function;
|
||||
extern rl_voidfunc_t *rl_redisplay_function;
|
||||
extern rl_compdisp_func_t *rl_completion_display_matches_hook;
|
||||
extern rl_vintfunc_t *rl_prep_term_function;
|
||||
extern rl_voidfunc_t *rl_deprep_term_function;
|
||||
extern rl_hook_func_t *rl_event_hook;
|
||||
extern int readline_echoing_p;
|
||||
extern int _rl_print_completions_horizontally;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: refresh.c,v 1.58 2021/09/09 20:24:07 christos Exp $ */
|
||||
/* $NetBSD: refresh.c,v 1.60 2024/12/05 22:21:53 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: refresh.c,v 1.58 2021/09/09 20:24:07 christos Exp $");
|
||||
__RCSID("$NetBSD: refresh.c,v 1.60 2024/12/05 22:21:53 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ re_putliteral(EditLine *el, const wchar_t *begin, const wchar_t *end)
|
|||
int i, w;
|
||||
|
||||
c = literal_add(el, begin, end, &w);
|
||||
if (c == 0 || w <= 0)
|
||||
if (c == 0 || w < 0)
|
||||
return;
|
||||
el->el_vdisplay[cur->v][cur->h] = c;
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ re_putliteral(EditLine *el, const wchar_t *begin, const wchar_t *end)
|
|||
while (--i > 0)
|
||||
el->el_vdisplay[cur->v][cur->h + i] = MB_FILL_CHAR;
|
||||
|
||||
cur->h += w;
|
||||
cur->h += w ? w : 1;
|
||||
if (cur->h >= sizeh) {
|
||||
/* assure end of line */
|
||||
el->el_vdisplay[cur->v][sizeh] = '\0';
|
||||
|
|
@ -212,7 +212,7 @@ re_putc(EditLine *el, wint_t c, int shift)
|
|||
if (!shift)
|
||||
return;
|
||||
|
||||
cur->h += w; /* advance to next place */
|
||||
cur->h += w ? w : 1; /* advance to next place */
|
||||
if (cur->h >= sizeh) {
|
||||
/* assure end of line */
|
||||
el->el_vdisplay[cur->v][sizeh] = '\0';
|
||||
|
|
@ -1155,6 +1155,10 @@ re_fastaddc(EditLine *el)
|
|||
wchar_t c;
|
||||
int rhdiff;
|
||||
|
||||
if (el->el_line.cursor == el->el_line.buffer) {
|
||||
re_refresh(el);
|
||||
return;
|
||||
}
|
||||
c = el->el_line.cursor[-1];
|
||||
|
||||
if (c == '\t' || el->el_line.cursor != el->el_line.lastchar) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: search.c,v 1.51 2020/03/30 06:56:38 ryo Exp $ */
|
||||
/* $NetBSD: search.c,v 1.52 2024/06/30 16:26:30 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.51 2020/03/30 06:56:38 ryo Exp $");
|
||||
__RCSID("$NetBSD: search.c,v 1.52 2024/06/30 16:26:30 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -295,6 +295,9 @@ ce_inc_search(EditLine *el, int dir)
|
|||
for (cp = &el->el_search.patbuf[LEN];; cp++)
|
||||
if (cp >= &el->el_search.patbuf[
|
||||
el->el_search.patlen]) {
|
||||
if (el->el_line.cursor ==
|
||||
el->el_line.buffer)
|
||||
break;
|
||||
el->el_line.cursor +=
|
||||
el->el_search.patlen - LEN - 1;
|
||||
cp = c__next_word(el->el_line.cursor,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $ */
|
||||
/* $NetBSD: sig.c,v 1.28 2024/12/18 15:38:52 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $");
|
||||
__RCSID("$NetBSD: sig.c,v 1.28 2024/12/18 15:38:52 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ sig_set(EditLine *el)
|
|||
struct sigaction osa, nsa;
|
||||
|
||||
nsa.sa_handler = sig_handler;
|
||||
nsa.sa_flags = 0;
|
||||
nsa.sa_flags = SA_ONSTACK;
|
||||
sigemptyset(&nsa.sa_mask);
|
||||
|
||||
sel = el;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sys.h,v 1.28 2023/02/04 14:34:28 christos Exp $ */
|
||||
/* $NetBSD: sys.h,v 1.29 2023/04/25 17:51:32 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
#if !defined(__attribute__) && !defined(__lint__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
|
||||
# define __attribute__(A)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tokenizer.c,v 1.28 2016/04/11 18:56:31 christos Exp $ */
|
||||
/* $NetBSD: tokenizer.c,v 1.29 2023/05/30 11:53:40 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.28 2016/04/11 18:56:31 christos Exp $");
|
||||
__RCSID("$NetBSD: tokenizer.c,v 1.29 2023/05/30 11:53:40 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ typedef enum {
|
|||
struct TYPE(tokenizer) {
|
||||
Char *ifs; /* In field separator */
|
||||
size_t argc, amax; /* Current and maximum number of args */
|
||||
Char **argv; /* Argument list */
|
||||
const Char **argv; /* Argument list */
|
||||
Char *wptr, *wmax; /* Space and limit on the word buffer */
|
||||
Char *wstart; /* Beginning of next word */
|
||||
Char *wspace; /* Space of word buffer */
|
||||
|
|
@ -424,7 +424,7 @@ FUN(tok,line)(TYPE(Tokenizer) *tok, const TYPE(LineInfo) *line,
|
|||
tok->wmax = s + size;
|
||||
}
|
||||
if (tok->argc >= tok->amax - 4) {
|
||||
Char **p;
|
||||
const Char **p;
|
||||
tok->amax += AINCR;
|
||||
p = tok_realloc(tok->argv, tok->amax * sizeof(*p));
|
||||
if (p == NULL) {
|
||||
|
|
@ -444,7 +444,7 @@ FUN(tok,line)(TYPE(Tokenizer) *tok, const TYPE(LineInfo) *line,
|
|||
if (cursoro != NULL)
|
||||
*cursoro = co;
|
||||
FUN(tok,finish)(tok);
|
||||
*argv = (const Char **)tok->argv;
|
||||
*argv = tok->argv;
|
||||
*argc = (int)tok->argc;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue