commit bash-20190321 snapshot

This commit is contained in:
Chet Ramey
2019-03-22 09:08:20 -04:00
parent 15a23d4474
commit 6e5013142b
7 changed files with 105 additions and 11 deletions
+1 -1
View File
@@ -624,7 +624,7 @@ rl_get_previous_history (int count, int key)
if (temp == 0)
{
rl_maybe_unsave_line ();
_rl_free_saved_history_line ();
rl_ding ();
}
else
+22 -2
View File
@@ -55,12 +55,18 @@ ansicstr (string, len, flags, sawc, rlen)
int c, temp;
char *ret, *r, *s;
unsigned long v;
size_t clen;
int b, mb_cur_max;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
#endif
if (string == 0 || *string == '\0')
return ((char *)NULL);
mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
temp = 4*len + 1;
temp = 4*len + 4;
if (temp < 12)
temp = 12; /* ensure enough for eventual u32cesc */
ret = (char *)xmalloc (temp);
@@ -71,7 +77,21 @@ ansicstr (string, len, flags, sawc, rlen)
{
c = *s++;
if (c != '\\' || *s == '\0')
*r++ = c;
{
clen = 1;
#if defined (HANDLE_MULTIBYTE)
if ((locale_utf8locale && (c & 0x80)) ||
(locale_utf8locale == 0 && mb_cur_max > 0 && is_basic (c) == 0))
{
clen = mbrtowc (&wc, s - 1, mb_cur_max, 0);
if (MB_INVALIDCH (clen))
clen = 1;
}
#endif
*r++ = c;
for (--clen; clen > 0; clen--)
*r++ = *s++;
}
else
{
switch (c = *s++)