summaryrefslogtreecommitdiffstats
path: root/lib/libedit (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ce examples of "Ar arg Ar arg" with "Ar arg arg" and stop the spread;jmc2020-04-231-4/+4
|
* Correct the length of read from file, wide character buffer, add NULasou2019-09-041-5/+5
| | | | | | | | terminate to read buffer. This fix the bug that does not run input command entered by vi editor. This fix is come from NetBSD lib/libedit/vi.c 1.46 and 1.47. ok schwarze@ deraadt@
* Correct the length for argument of reallocarray(). This fix the SEGVasou2019-09-031-2/+2
| | | | | | | when launch the vi editor in vi mode. This fix is similar 1.63 from NetBSD lib/libedit/vi.c. OK schwarze@ yasuoka@
* read() returns -1 on failureasou2019-08-141-2/+2
| | | | ok yasuoka@
* Initialize the line buffer by zero when allocation. This fixes theyasuoka2019-08-071-5/+5
| | | | | | | problem a crash happens after the window size change. Worked and discussed with asou and schwarze. ok schwarze
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-5/+5
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* mkstemp() returns -1 on failurederaadt2019-06-281-2/+2
|
* Terminate NULL in argv. This fix is come from 1.31 from NetBSDyasuoka2019-01-291-2/+3
| | | | | | lib/libedit/chartype.c via FreeBSD. From tj@ ok tb
* Fix the inter-library dependency for libedit and libreadline.yasuoka2019-01-151-3/+3
| | | | | | | Previously they tried to depend on libtermcap which actually doesn't exist in the objdir. ok jca
* Record an inter-library dependency on libcurses in libedit and libreadline,sthen2018-11-141-1/+4
| | | | | | | | | | avoiding runtime failures on architectures using ld.lld. Also add a note to libcurses shlib_version reminding about bumps (as done with libcrypto/libssl). Thanks guenther@ for suggestions of tests involving library bumps and jca@ for doing these tests and hint about DPADD. Looks good kettenis@, ok jca@
* In re_fastputc(), set lastline to the new line, not the previousmillert2018-10-111-2/+2
| | | | | line so it gets initialized properly. Fixes a crash in bc with MALLOC_OPTIONS=UJ. OK deraadt@, committing on behalf of yasuoka@
* remove the remaining references to .depend files since nothing creates themnaddy2017-10-171-2/+2
| | | | any longer; ok espie@ deraadt@
* Initialize "old" screen buffer lines before use; otherwise, they wouldschwarze2017-07-261-8/+10
| | | | | | | | never get NUL-terminated and cause read buffer overruns. This fixes for example segfaults in sftp(1) that could be triggered by typing in an extremely long string (more than one line - the longer, the likelier to crash), then hitting backspace once. Problem reported and patch OK'ed by sthen@.
* remove misc. depend and yacc nits that no longer matter.espie2017-07-101-2/+2
| | | | okay millert@
* Generate source and header files for regress on demand.bluhm2017-07-031-4/+6
| | | | OK espie@
* mark files as BUILDFIRST, or write explicit dependencies, so that mostespie2017-06-161-1/+2
| | | | | programs will build even without a make depend first. okay tb@ millert@
* Use calloc(3) and recallocarray(3) instead of *alloc* + memset(0).tb2017-04-124-38/+17
| | | | ok deraadt
* Fix a crash in stifle_history() that occurred when the historyschwarze2016-05-311-2/+2
| | | | | | | | contained more than twice as many entries as the new limit: The argument of remove_history() only counts existing elements, not those previously deleted. Crash found by bentley@ when exiting sqlite3(1).
* el_map.alt can never be NULL, delete dead codeschwarze2016-05-251-4/+2
| | | | OK czarkoff@
* Saving errno in el_errno is only needed for one purpose:schwarze2016-05-253-35/+26
| | | | | | | | | | | | | | | | | Restoring the original errno found in el_wgetc() after el_wgets() did some cleanup that may have changed errno. Improve clarity and robustness of the code by not setting and inspecting el_errno where it isn't needed; in particular, let keymacro_get() properly report read failure to read_getcmd(). Move el_errno to el_read_t because it's only used in read.c. Never set errno back to zero. Checked with a test program installing a USR1 signal handler without SA_RESTART, for the cases read_getcmd(), ed_quoted_insert(), keymacro_get(), ed_command(), and EL_EDITMODE=0. OK czarkoff@
* Remove debugging ifdefs.schwarze2016-05-242-72/+5
| | | | | | I'm debugging the read module for weeks now, but these ifdefs aren't helpful. OK cpp(1).
* Improve modularization at the chared/read boundary, no functional change.schwarze2016-05-226-53/+63
| | | | | | | | | | | | Stop the read.c module from poking the el_chared.c_macro data structure that used to belong to the chared.c module. Given that no other module, not even chared itself, is using that data, move it into the read modules's own opaque data structure, struct el_read_t. That gets rid of one struct, one #define, one struct member, and one function argument in the chared.h interface. OK czarkoff@
* Document el_wpush(3) and fix the description of el_push(3).schwarze2016-05-222-39/+42
| | | | | Improve precision in the description of the "bind" builtin command. Tweak terminology to better match editline(7).
* Simple sync with NetBSD, mostly to avoid confusion of arguments andschwarze2016-05-211-27/+36
| | | | return values.
* Fix the prototype used by EL_GETCFN, mention the associated typedef name,schwarze2016-05-211-19/+34
| | | | | document the return values, expand the list of affected functions, warn against using EL_GETCFN, and clarify some wording and notation.
* Move the declaration of the function pointer type el_rfunc_tschwarze2016-05-205-28/+35
| | | | | | | | | | | | | | | from the private header "read.h" to the public header <histedit.h>. That's not an interface change, it was already used and documented publicly, merely not properly declared. Improve encapsulation: Make el_read a pointer to an opaque struct in struct editline, such that "read.h" no longer needs to be included from "el.h" but only from the two files using it, read.c and el.c. Only pass the required el_read_t to el_read_{s,g}etfn(), do not pass the full struct editline. OK czarkoff@, also proofread by Christian Heckendorf <mbie at ulmus dot me>.
* Enable separate compilation while keeping internal interfaces hidden.schwarze2016-05-103-37/+7
| | | | | | | | Simplifies the build system and prevents modules from stomping on each other's static symbols. Based on a hint from guenther@, using feedback from kettenis@ and deraadt@.
* Fix next_history() and previous_history():schwarze2016-05-103-8/+34
| | | | | | | | | | | | * The meaning of "next" and "previous" is exchanged in readline(3) with respect to editline(3); this part of the patch from Bastian Maerkisch. * next_history() can move beyond the newest entry; issue pointed out by Bastian Maerkisch, fix by me. While here, make the documentation of ed-next-history, ed-prev-history, H_NEXT, and H_PREV more precise. OK czarkoff@.
* Fix history_get():schwarze2016-05-101-8/+20
| | | | | | | | | | | | * Respect history_base. * Bail out early for arguments that are too small. * Select entry by readline offset, not by editline event number. * Restore history cursor in case of failure. This fixes the test_remove() regression test. Based on a patch from Bastian Maerkisch <bmaerkisch at web dot de>. Dmitrij Czarkoff pointed out a flaw in it that i fixed. OK czarkoff@.
* Fix stifle_history(): Remove excessive entries, if any.schwarze2016-05-091-2/+14
| | | | | | Based on a patch from Bastian Maerkisch <bmaerkisch at web dot de>, with an additional fix for a memory leak by me. OK czarkoff@
* Change where_history() to agree with the GNU implementation:schwarze2016-05-081-4/+7
| | | | | | | | | Return 0 for the oldest entry and increment by 1 for each newer, non-deleted entry. This fixes the test_where() regression test. Patch from Bastian Maerkisch <bmaerkisch at web dot de>. OK czarkoff@.
* Make the history_set_pos() return values agree with the GNU implementation.schwarze2016-05-081-5/+5
| | | | | | | | | Patch from Bastian Maerkisch <bmaerkisch at web dot de> with a minor tweak from Christos Zoulas. Fixes the test_set_pos_return_values() regression test. OK czarkoff@, also proofread by zhuk@ and by Christian Heckendorf <mbie at ulmus dot me>.
* typos in comments; from Pedro Giffuni (FreeBSD) via Christos Zoulas (NetBSD)schwarze2016-05-062-6/+6
|
* Replace the generated file "fcns.c" by a simpler header "func.h"schwarze2016-05-0616-45/+49
| | | | | | | | | | | included only in the one file needing it, "map.c". That allows to define el_action_t directly in "map.h", which in turn allows to stop including "fcns.h" from "el.h" and include it only in the modules needing it. Now we no longer autogenerate any C files. Feedback and OK martijn@. First version also proofread by Christian Heckendorf <mbie at ulmus dot me>.
* Combine help.h and help.c into a simplified help.hschwarze2016-05-034-31/+11
| | | | | | and include it only in the one file needing it, map.c. Also delete makelist -bc. OK martijn@, also proofread by Christian Heckendorf <mbie at ulmus dot me>
* The files editline.c, historyn.c, and tokenizern.c are completelyschwarze2016-05-035-43/+38
| | | | | | constant and very short and simple. Check them into CVS rather than generating them at build time in a complicated way. OK martijn@, also proofread by Christian Heckendorf <mbie at ulmus dot me>
* Initialize the search buffer.schwarze2016-04-281-1/+2
| | | | | | | | | | | | | Otherwise, if you called ed-search-prev-history before doing any history search but after entering at least one line into the history, the buffer could get accessed uninitialized, potentially resulting in a read buffer overrun. Segfault reported in sftp(1) via djm@ by Alf Schlichting <A dot Schlichting at lemarit dot com>, who also confirmed that the patch fixes the issue for him. OK martijn@ czarkoff@
* delete unused -m option;schwarze2016-04-201-39/+1
| | | | | ok martijn@ also checked by Christian Heckendorf <mbie at ulmus dot me>
* New editline(7) manual, explaining to end-users how line editing worksschwarze2016-04-204-207/+940
| | | | | | | | | | | | in programs like ftp(1), sftp(1), bc(1), and cdio(1) that use libedit. The existing editrc(5) manual only explains customization, and the existing editline(3) manual only explains the C language interface. Already listing all editor functions and all default key bindings, but in other respects, not 100% complete yet, and due to the sheer size, some bugs may have slipped, but all that can be fixed in the tree. OK and tweaks jmc@. Also seems reasonable to Christian Heckendorf <mbie at ulmus dot me>.
* Delete redundant, empty callbacks;schwarze2016-04-183-133/+33
| | | | | | no functional change, minus hundred lines of code. OK martijn@; also proof-read by Christian Heckendorf <mbie at ulmus dot me>.
* Re-introduce the following commit:schwarze2016-04-131-2/+2
| | | | | | | | | | OpenBSD read.c rev. 1.4 1997/06/10 20:10:13 millert FIONREAD takes int *, not long * It got lost in the following merge from NetBSD: OpenBSD read.c rev. 1.10 2003/10/31 08:42:24 otto OK millert@ martijn@
* Cleanup, no functional change:schwarze2016-04-121-16/+10
| | | | | | | * Make the return value from read_getcmd() less confusing. * No need to store that return value; testing it once is enough. * Get rid of one #ifdef section in el_wgets(). OK czarkoff@ martijn@
* * Delete the unimplemented feature XK_EXE.schwarze2016-04-124-29/+8
| | | | | | * Delete the unused macro MIN(). No functional change. OK czarkoff@ martijn@
* delete the "private" and "public" preprocessor macros, just use standard C;schwarze2016-04-1120-252/+245
| | | | OK martijn@
* Clean up chartype.h:schwarze2016-04-114-25/+14
| | | | | | | | | * not used in tokenizer.c * only use it for !NARROWCHAR * no need for underscores before ct_{de,en}code_string() * make the conversion buffer resize function private OK martijn@
* get rid of the non-standard data type "Char" in almost all files;schwarze2016-04-1132-378/+375
| | | | ok martijn@
* Move wrapper macros to the two files actually needing them:schwarze2016-04-1120-179/+195
| | | | | | | | | | | FUNW, Strlen, Strdup, Strcmp, Strncmp, Strncpy, Strncat -> history.c Strchr, tok_strdup -> tokenizer.c FUN, TYPE, STR -> both of these files OK martijn@ Also proofread by Christian Heckendorf <mbie at ulmus dot me> who reported some whitespace issues in parse.c.
* For pointers, use NULL rather than 0; no functional change;schwarze2016-04-092-6/+6
| | | | from Pedro Giffuni via Christos Zoulas.
* Delete 26 wrapper macros and two wrapper functions that are noschwarze2016-04-0916-148/+113
| | | | | | | | longer needed now that we always compile with wide character support, reducing code obfuscation. OK czarkoff@ martijn@. Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.
* Always compile with WIDECHAR on and delete that preprocessor switch.schwarze2016-04-0917-184/+27
| | | | | OK martijn@. Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.