commit bash-20180406 snapshot

This commit is contained in:
Chet Ramey
2018-04-12 15:09:21 -04:00
parent 13b0033c46
commit d155fbc5fd
20 changed files with 294 additions and 24 deletions
+45 -1
View File
@@ -380,6 +380,50 @@ is_wcclass (wc, name)
return (iswctype (wc, desc));
}
/* Return 1 if there are no char class [:class:] expressions (degenerate case)
or only posix-specified (C locale supported) char class expressions in
PATTERN. These are the ones where it's safe to punt to the single-byte
code, since wide character support allows locale-defined char classes.
This only uses single-byte code, but is only needed to support multibyte
locales. */
static int
posix_cclass_only (pattern)
char *pattern;
{
char *p, *p1;
char cc[16]; /* sufficient for all valid posix char class names */
enum char_class valid;
p = pattern;
while (p = strchr (p, '['))
{
if (p[1] != ':')
{
p++;
continue;
}
p += 2; /* skip past "[:" */
/* Find end of char class expression */
for (p1 = p; *p1; p1++)
if (*p1 == ':' && p1[1] == ']')
break;
if (*p1 == 0) /* no char class expression found */
break;
/* Find char class name and validate it against posix char classes */
if ((p1 - p) >= sizeof (cc))
return 0;
bcopy (p, cc, p1 - p);
cc[p1 - p] = '\0';
valid = is_valid_cclass (cc);
if (valid == CC_NO_CLASS)
return 0; /* found unrecognized char class name */
p = p1 + 2; /* found posix char class name */
}
return 1; /* no char class names or only posix */
}
/* Now include `sm_loop.c' for multibyte characters. */
#define FOLD(c) ((flags & FNM_CASEFOLD) && iswupper (c) ? towlower (c) : (c))
#define FCT internal_wstrmatch
@@ -419,7 +463,7 @@ xstrmatch (pattern, string, flags)
if (MB_CUR_MAX == 1)
return (internal_strmatch ((unsigned char *)pattern, (unsigned char *)string, flags));
if (mbsmbchar (string) == 0 && mbsmbchar (pattern) == 0)
if (mbsmbchar (string) == 0 && mbsmbchar (pattern) == 0 && posix_cclass_only (pattern) )
return (internal_strmatch ((unsigned char *)pattern, (unsigned char *)string, flags));
n = xdupmbstowcs (&wpattern, NULL, pattern);
+1
View File
@@ -1149,6 +1149,7 @@ and store the definition.
.B call\-last\-kbd\-macro (C\-x e)
Re-execute the last keyboard macro defined, by making the characters
in the macro appear as if typed at the keyboard.
.TP
.B print\-last\-kbd\-macro ()
Print the last keyboard macro defined in a format suitable for the
\fIinputrc\fP file.