* 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@
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.
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>.
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@
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@
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@
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@
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@.
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.