summaryrefslogtreecommitdiffstats
path: root/lib/libedit (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Reset the terminal to its initial state before exiting a programschwarze2016-04-092-9/+25
| | | | | | | | | | | using libedit, using code from NetBSD tty.c rev. 1.42, 1.48, 1.49, 1.58, and 1.59. Code mostly by Christos Zoulas, one bug report by John Hein, one additional bugfix by me (rev. 1.59). While here, switch t_mode to unsigned char, which is sufficient, also from NetBSD. OK martijn@. Also checked by Christian Heckendorf <mbie at ulmus dot me>.
* Move more fcntl(,F_GETFL,0) -> fcntl(,F_GETFL).krw2016-04-051-2/+2
| | | | | | No functional change. ok guenther@
* for some time now mandoc has not required MLINKS to functionjmc2016-03-301-22/+1
| | | | | | | | | | | | correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
* format string fixes in debug code;schwarze2016-03-227-32/+39
| | | | committing right away because this code is not even compiled by default
* Add NULL checkmartijn2016-03-221-2/+3
| | | | OK schwarze@
* Fix an obvious typo in a NUL check;schwarze2016-03-221-2/+2
| | | | | | bug reported by David Binderman http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50880 fix suggested by me, NetBSD rev. 1.23 and rev. 1.24.
* Christos Zoulas just rescinded clauses 3 & 4 of his licenses, seeschwarze2016-03-213-24/+3
| | | | | NetBSD chartype.c rev. 1.23, chartype.h rev. 1.25, eln.c rev. 1.28. No code change.
* Markup fixes: use .Ev and .Er where appropriate.schwarze2016-03-211-8/+8
| | | | | | | While here, also use \-1 rather than -1; not sure that's really better, but Thomas is right it should at least be consistent within a page. From Thomas Klausner <wiz @ NetBSD>.
* fix el_{w,}getc documentation;schwarze2016-03-211-10/+48
| | | | OK czarkoff@
* Make the read_char() function always take a wchar_t * argument.schwarze2016-03-218-41/+36
| | | | | | | | | | | On first sight, it might look as if this required a bump because it seems to change the public type el_rfunc_t. But we only compile with WIDECHAR, and in that case, there is no change in the interface. This also simplifies some logic by getting rid of the NARROW_READ flag which was broken anyway. OK czarkoff@
* Reduce the FUN() macro madness by no longer applying it to el_[w]getc(3).schwarze2016-03-217-34/+41
| | | | | | | | | Always use el_wgetc(3) internally. In the !WIDECHAR case, casting the result to (Char) is safe because the function returns a byte rather than a character in that case. No functional change except for fixing a printf(3) format string issue when compiled with DEBUG_READ and WIDECHAR. OK czarkoff@
* Merge a few simple fixes from NetBSD:schwarze2016-03-211-6/+10
| | | | | | | | | | NetBSD rev. 1.68 2012/09/10 christos (bugfixes from Steffen Nurpmeso) * el_wgetc(): set el_errno after read_char() failure * el_wgets(): flag error condition after read_getcmd() failure NetBSD rev. 1.69 2012/09/11 christos (bugfix from Christos Zoulas) * read_getcmd(): return failure after el_wgetc() failure NetBSD rev. 1.75 2016/02/12 christos (cleanup from Christos Zoulas) * read_getcmd(): use a constant rather than a magical number
* Cleanup of standard header inclusion:schwarze2016-03-2033-170/+178
| | | | | | | | | | | | | 1. Add the missing <errno.h> to sig.c. 2. Do not include standard headers from private headers "chared.h" and "el.h", include them directly where needed. 3. Delete a few needless inclusions of <ctype.h>. 4. Sort the standard headers. 5. Delete _GNU_SOURCE weirdness from histedit.h, that file doesn't even need the access to wcsdup(3) mentioned in the comment. 6. Delete some trailing blanks and blanks before tabs. OK czarkoff@
* delete useless "typedef int bool_t", use int directly;schwarze2016-03-202-7/+5
| | | | OK czarkoff@
* Cleanup of private header inclusion:schwarze2016-03-2023-67/+61
| | | | | | | | | | | | | | 1. Do not include private headers from "chared.h", "hist.h", "prompt.h", "refresh.h", "search.h", "sig.h", "terminal.h", "tty.h". The only private header having to include other private headers is "el.h". 2. Do not include "common.h", "parse.h", "help.h" from "el.h", and do not include "emacs.h" and "vi.h" from "chared.h", include them directly where needed. 3. Do include "fcns.h" from "el.h" because el_func_t is needed for "map.h". 4. Do not include private headers again that are already included by "el.h". 5. Include private headers after standard headers. OK czarkoff@
* support WIDECHAR;schwarze2016-03-201-1/+7
| | | | OK czarkoff@
* Use getline(3) rather than fgetln(3) because it is standardizedschwarze2016-03-204-42/+34
| | | | | and simpler and safer to use. Implemented by Christos Zoulas following my suggestion, with a bug fix by me.
* minor simplifactions, style fixes, and trivial syncs from NetBSDschwarze2016-03-203-19/+18
|
* Fix the same bug again that was already fixed in:schwarze2016-03-201-3/+5
| | | | | | | | OpenBSD tokenizer.c rev. 1.8 2003/08/11 18:21:40 deraadt Don't increase amax on realloc() failure. The original fix got lost in a merge along the way. This fix from Christos Zoulas via NetBSD tokenizer.c rev. 1.23 2016/02/15. OK czarkoff@
* Delete the useless Int datatype and always use the standard wint_tschwarze2016-03-2017-173/+172
| | | | | | | | directly. This is not a problem because <wchar_t> is required all over the place anyway, even when WIDECHAR is not defined. No functional change except that it fixes a few printf(3) format string issues, %c vs. %lc. OK czarkoff@
* Get rid of "#ifdef WIDECHAR" and one goto in read_char(),schwarze2016-03-203-15/+24
| | | | | | | making the code more readable. Instead, provide an mbrtowc(3) replacement function in chartype.[hc], files that encapsulate such system dependencies anyway. No functional change. OK czarkoff@
* Delete the weird IGNORE_EXTCHARS flag, simplifying the codeschwarze2016-03-203-16/+21
| | | | | | | | in the generic low-level function read_char(). Until we fully enable UTF-8 support, instead filter out non-ASCII characters in the more logical place in the high-level function el_gets(3). OK czarkoff@.
* Fix the public interface function el_getc(3).schwarze2016-03-202-11/+17
| | | | | | | | | | | On OpenBSD, the effects are to set the return argument to the NUL byte in case of a read failure (for robustness) and to properly set errno when the character is out of range and cannot be stored in a byte. Once we enable UTF-8, this will be needed to avoid returning bogus bytes for valid Unicode characters. On systems where the internal representation of wchar_t doesn't match UCS-4, breakage was potentially even worse. OK czarkoff@.
* Fix read_char() for the non-UTF-8 case, in particular for systemsschwarze2016-03-201-5/+12
| | | | | | | supporting other multibyte locales or having an internal representation of wchar_t that doesn't match UCS-4. No functional change on OpenBSD, but it makes the code less confusing. OK czarkoff@.
* Fix the CHARSET_IS_UTF8 case in read_char().schwarze2016-03-202-24/+43
| | | | | | | | | | | | | | | | | For now, this mainly help programs explicitly using wide-character functions like el_wgetc(3) and el_wgets(3). 1. After reading an invalid byte sequence, do not throw away additional valid bytes; fix by me using mbrtowc(3), obsoleting utf8_islead(). 2. When read(2) returns EOF, return that information to the caller, do not prod on and potentially access garbage data in the buffer; from Linas Vepstas via NetBSD read.c rev. 1.70 2013/05/27. 3. After read__fixio() failure, restore errno to the one set by read(); from Steffen Nurpmeso via NetBSD read.c rev. 1.68 2012/09/10. 4. After read__fixio() success, restore errno to the initial state upon function entry; fix by me. OK czarkoff@. Also committed to NetBSD.
* Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])krw2016-03-201-2/+2
| | | | | | | | | | idioms. Adopt the more concise fcntl(n, F_GETFL) over fcntl(n, F_GETFL, 0) where it is obvious further investigation will not yield and even better way. Obviousness evaluation and ok guenther@
* Fix a segfault and functional error in c_gets(),schwarze2016-03-011-1/+2
| | | | | | | | | | | which is used for extended command input and for vi search mode. It could be triggered by typing one or more characters, then pressing backspace once (functional error: the character was deleted from the screen, but not from the edit buffer) or a few more times than characters had been entered (segfault). OK czarkoff@. Also checked by Christos Zoulas.
* Get rid of an ugly #ifdef in the middle of el_init() byschwarze2016-02-022-5/+11
| | | | | | hiding the system dependencies away in "sys.h" where they belong. No binary change on OpenBSD. Seems reasonable to christos at NetBSD, too.
* remove some whitespace differences with NetBSD; no change with diff -bschwarze2016-01-312-15/+15
|
* trivial partial sync to NetBSD, no functional change:schwarze2016-01-311-12/+7
| | | | | | * remove unused ifdef'ed header junk * remove pointless cast of NULL * wrap two excessively long lines
* Fifth step in synching with NetBSD:schwarze2016-01-3015-159/+113
| | | | | | | | | Delete the silly ptr_t and ioctl_t typedefs and delete some "#ifdef notdef" code from "sys.h". No functional change. This makes hist.h identical to the NetBSD version. It reduces the remaining diff from +1526 -734 to +1430 -592. OK czarkoff@
* Fourth step in synching with NetBSD:schwarze2016-01-3018-551/+551
| | | | | | | KNF: Remove parentheses from return lines. No object change. This makes emacs.c and prompt.c identical to the NetBSD versions. It reduces the remaining diff from +2053 -1261 to +1526 -734. OK czarkoff@
* delete "#ifdef notdef" code that is no longer present in NetBSD;schwarze2016-01-303-162/+3
| | | | no change in the generated source files
* Third step in synching with NetBSD:schwarze2016-01-3018-419/+427
| | | | | | | | | | | * rename fkey_t to funckey_t and el_term_t to el_terminal_t * rename struct editline member el_term to el_terminal * rename many functions in terminal.c from term_*() to terminal_*(), for consistency with the file name and to not look related to <term.h> No functional change. This makes refresh.c and sig.c almost identical to the NetBSD versions. It reduces the remaining diff from +2446 -1805 to +2053 -1420. OK czarkoff@
* Second step in synching with NetBSD:schwarze2016-01-299-212/+213
| | | | | | | | | | | * Rename some types from *key*_t to *keymacro*_t. * Rename struct editline member el_key to el_keymacro. * Rename some functions in keymacro.c from key*() to keymacro*(). This removes the conflict of key_clear(), key_end(), and key_print() with macros in <term.h>. No functional change. This makes keymacro.h identical to the NetBSD version. It reduces the remaining diff from +2640 -1998 to +2446 -1805. OK czarkoff@
* Start synching with NetBSD:schwarze2016-01-296-17/+17
| | | | | | | | | | Rename the files key.[hc] to keymacro.[hc] and term.[hc] to terminal.[hc]. The change makes sense because "term.h" conflicts with <term.h> and the functions key_clear(), key_end(), and key_print() in "key.h" conflict with macros in <term.h>. No content change yet, no binary change in *.o after "strip -d". This reduces the remaining diff from +4634 -3992 to +2640 -1998. OK czarkoff@, and mmcc@ agrees with the direction.
* Zap extraneous SYNOPSIS sections.zhuk2016-01-081-4/+2
| | | | | | The gettytab(5) and termcap(5) get FILES, others don't need anything. With input from & okay schwarze@
* in the SYNOPSIS, make void function arguments explicitschwarze2015-09-141-4/+4
|
* missing commas at the end of .Nm lines in the NAME sectionschwarze2015-09-101-3/+3
|
* gcc 2.x is deadguenther2015-04-041-2/+2
| | | | ok millert@
* remove the first comma from constructs like ", and," and ", or,": you can usejmc2015-03-131-3/+3
| | | | | "and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;
* SIZE_MAX is standard, we should be using it in preference to themillert2015-02-061-2/+3
| | | | obsolete SIZE_T_MAX. OK miod@ beck@
* Move to the <limits.h> universe.deraadt2015-01-161-3/+3
| | | | review by millert, binary checking process with doug, concept with guenther
* libedit claims compatibility with readline 4.2, so provide a stub forreyk2015-01-133-3/+11
| | | | | | | rl_set_keyboard_input_timeout() that was added in this version. Also crank the minor version. OK krw@ yasuoka@ deraadt@
* merge improvements from NetBSD; ok jmc@ nicm@schwarze2014-12-152-14/+24
|
* markup fixes from Kaspars at Bankovskis dot net;schwarze2014-12-122-11/+19
| | | | | some of this is already contained upstream in NetBSD, the rest will be sent there
* Remove non-exposed malloc/realloc/free wrappers, and then substitutederaadt2014-10-1717-196/+181
| | | | | reallocarray() where it helps. ok doug
* use reallocarray()deraadt2014-10-151-5/+6
|
* Userland reallocarray() audit.doug2014-10-111-3/+4
| | | | | | | Avoid potential integer overflow in the size argument of malloc() and realloc() by using reallocarray() to avoid unchecked multiplication. ok deraadt@
* Userland reallocarray() audit.doug2014-10-111-3/+3
| | | | | | | Avoid potential integer overflow in the size argument of malloc() and realloc() by using reallocarray() to avoid unchecked multiplication. ok deraadt@