summaryrefslogtreecommitdiff
path: root/lib/libedit
AgeCommit message (Collapse)Author
2016-04-12Cleanup, no functional change:Ingo Schwarze
* 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@
2016-04-12* Delete the unimplemented feature XK_EXE.Ingo Schwarze
* Delete the unused macro MIN(). No functional change. OK czarkoff@ martijn@
2016-04-11delete the "private" and "public" preprocessor macros, just use standard C;Ingo Schwarze
OK martijn@
2016-04-11Clean up chartype.h:Ingo Schwarze
* 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@
2016-04-11get rid of the non-standard data type "Char" in almost all files;Ingo Schwarze
ok martijn@
2016-04-11Move wrapper macros to the two files actually needing them:Ingo Schwarze
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.
2016-04-09For pointers, use NULL rather than 0; no functional change;Ingo Schwarze
from Pedro Giffuni via Christos Zoulas.
2016-04-09Delete 26 wrapper macros and two wrapper functions that are noIngo Schwarze
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>.
2016-04-09Always compile with WIDECHAR on and delete that preprocessor switch.Ingo Schwarze
OK martijn@. Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-04-09Reset the terminal to its initial state before exiting a programIngo Schwarze
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>.
2016-04-05Move more fcntl(,F_GETFL,0) -> fcntl(,F_GETFL).Kenneth R Westerback
No functional change. ok guenther@
2016-03-30for some time now mandoc has not required MLINKS to functionJason McIntyre
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
2016-03-22format string fixes in debug code;Ingo Schwarze
committing right away because this code is not even compiled by default
2016-03-22Add NULL checkmartijn
OK schwarze@
2016-03-22Fix an obvious typo in a NUL check;Ingo Schwarze
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.
2016-03-21Christos Zoulas just rescinded clauses 3 & 4 of his licenses, seeIngo Schwarze
NetBSD chartype.c rev. 1.23, chartype.h rev. 1.25, eln.c rev. 1.28. No code change.
2016-03-21Markup fixes: use .Ev and .Er where appropriate.Ingo Schwarze
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>.
2016-03-21fix el_{w,}getc documentation;Ingo Schwarze
OK czarkoff@
2016-03-21Make the read_char() function always take a wchar_t * argument.Ingo Schwarze
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@
2016-03-21Reduce the FUN() macro madness by no longer applying it to el_[w]getc(3).Ingo Schwarze
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@
2016-03-21Merge a few simple fixes from NetBSD:Ingo Schwarze
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
2016-03-20Cleanup of standard header inclusion:Ingo Schwarze
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@
2016-03-20delete useless "typedef int bool_t", use int directly;Ingo Schwarze
OK czarkoff@
2016-03-20Cleanup of private header inclusion:Ingo Schwarze
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@
2016-03-20support WIDECHAR;Ingo Schwarze
OK czarkoff@
2016-03-20Use getline(3) rather than fgetln(3) because it is standardizedIngo Schwarze
and simpler and safer to use. Implemented by Christos Zoulas following my suggestion, with a bug fix by me.
2016-03-20minor simplifactions, style fixes, and trivial syncs from NetBSDIngo Schwarze
2016-03-20Fix the same bug again that was already fixed in:Ingo Schwarze
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@
2016-03-20Delete the useless Int datatype and always use the standard wint_tIngo Schwarze
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@
2016-03-20Get rid of "#ifdef WIDECHAR" and one goto in read_char(),Ingo Schwarze
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@
2016-03-20Delete the weird IGNORE_EXTCHARS flag, simplifying the codeIngo Schwarze
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@.
2016-03-20Fix the public interface function el_getc(3).Ingo Schwarze
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@.
2016-03-20Fix read_char() for the non-UTF-8 case, in particular for systemsIngo Schwarze
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@.
2016-03-20Fix the CHARSET_IS_UTF8 case in read_char().Ingo Schwarze
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.
2016-03-20Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])Kenneth R Westerback
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@
2016-03-01Fix a segfault and functional error in c_gets(),Ingo Schwarze
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.
2016-02-02Get rid of an ugly #ifdef in the middle of el_init() byIngo Schwarze
hiding the system dependencies away in "sys.h" where they belong. No binary change on OpenBSD. Seems reasonable to christos at NetBSD, too.
2016-01-31remove some whitespace differences with NetBSD; no change with diff -bIngo Schwarze
2016-01-31trivial partial sync to NetBSD, no functional change:Ingo Schwarze
* remove unused ifdef'ed header junk * remove pointless cast of NULL * wrap two excessively long lines
2016-01-30Fifth step in synching with NetBSD:Ingo Schwarze
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@
2016-01-30Fourth step in synching with NetBSD:Ingo Schwarze
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@
2016-01-30delete "#ifdef notdef" code that is no longer present in NetBSD;Ingo Schwarze
no change in the generated source files
2016-01-30Third step in synching with NetBSD:Ingo Schwarze
* 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@
2016-01-29Second step in synching with NetBSD:Ingo Schwarze
* 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@
2016-01-29Start synching with NetBSD:Ingo Schwarze
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.
2016-01-08Zap extraneous SYNOPSIS sections.Vadim Zhukov
The gettytab(5) and termcap(5) get FILES, others don't need anything. With input from & okay schwarze@
2015-09-14in the SYNOPSIS, make void function arguments explicitIngo Schwarze
2015-09-10missing commas at the end of .Nm lines in the NAME sectionIngo Schwarze
2015-04-04gcc 2.x is deadPhilip Guenther
ok millert@
2015-03-13remove the first comma from constructs like ", and," and ", or,": you can useJason McIntyre
"and" and "or" to join sentence clauses, and you can use commas, but both hinders reading;