mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 16:39:53 +02:00
commit bash-20191009 snapshot
This commit is contained in:
+25
-15
@@ -115,8 +115,9 @@ static int skipname __P((char *, char *, int));
|
||||
#if HANDLE_MULTIBYTE
|
||||
static int mbskipname __P((char *, char *, int));
|
||||
#endif
|
||||
void udequote_pathname __P((char *));
|
||||
#if HANDLE_MULTIBYTE
|
||||
static void udequote_pathname __P((char *));
|
||||
void wcdequote_pathname __P((wchar_t *));
|
||||
static void wdequote_pathname __P((char *));
|
||||
#else
|
||||
# define dequote_pathname udequote_pathname
|
||||
@@ -409,7 +410,7 @@ mbskipname (pat, dname, flags)
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
|
||||
/* Remove backslashes quoting characters in PATHNAME by modifying PATHNAME. */
|
||||
static void
|
||||
void
|
||||
udequote_pathname (pathname)
|
||||
char *pathname;
|
||||
{
|
||||
@@ -431,6 +432,26 @@ udequote_pathname (pathname)
|
||||
|
||||
#if HANDLE_MULTIBYTE
|
||||
/* Remove backslashes quoting characters in PATHNAME by modifying PATHNAME. */
|
||||
void
|
||||
wcdequote_pathname (wpathname)
|
||||
wchar_t *wpathname;
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = j = 0; wpathname && wpathname[i]; )
|
||||
{
|
||||
if (wpathname[i] == L'\\')
|
||||
i++;
|
||||
|
||||
wpathname[j++] = wpathname[i++];
|
||||
|
||||
if (wpathname[i - 1] == L'\0')
|
||||
break;
|
||||
}
|
||||
if (wpathname)
|
||||
wpathname[j] = L'\0';
|
||||
}
|
||||
|
||||
static void
|
||||
wdequote_pathname (pathname)
|
||||
char *pathname;
|
||||
@@ -458,18 +479,7 @@ wdequote_pathname (pathname)
|
||||
}
|
||||
orig_wpathname = wpathname;
|
||||
|
||||
for (i = j = 0; wpathname && wpathname[i]; )
|
||||
{
|
||||
if (wpathname[i] == L'\\')
|
||||
i++;
|
||||
|
||||
wpathname[j++] = wpathname[i++];
|
||||
|
||||
if (wpathname[i - 1] == L'\0')
|
||||
break;
|
||||
}
|
||||
if (wpathname)
|
||||
wpathname[j] = L'\0';
|
||||
wcdequote_pathname (wpathname);
|
||||
|
||||
/* Convert the wide character string into unibyte character set. */
|
||||
memset (&ps, '\0', sizeof(mbstate_t));
|
||||
@@ -686,7 +696,7 @@ glob_vector (pat, dir, flags)
|
||||
a filename `DIR/PAT'. If there is, and we can access it, just make the
|
||||
vector to return and bail immediately. */
|
||||
hasglob = 0;
|
||||
if (skip == 0 && (hasglob = glob_pattern_p (pat)) == 0 || hasglob == 2)
|
||||
if (skip == 0 && ((hasglob = glob_pattern_p (pat)) == 0 || hasglob == 2))
|
||||
{
|
||||
int dirlen;
|
||||
struct stat finfo;
|
||||
|
||||
@@ -29,6 +29,8 @@ static CHAR *PARSE_COLLSYM __P((CHAR *, INT *));
|
||||
static CHAR *BRACKMATCH __P((CHAR *, U_CHAR, int));
|
||||
static int EXTMATCH __P((INT, CHAR *, CHAR *, CHAR *, CHAR *, int));
|
||||
|
||||
extern void DEQUOTE_PATHNAME __P((CHAR *));
|
||||
|
||||
/*static*/ CHAR *PATSCAN __P((CHAR *, CHAR *, INT));
|
||||
|
||||
int
|
||||
@@ -456,6 +458,9 @@ BRACKMATCH (p, test, flags)
|
||||
{
|
||||
bcopy (p + 1, ccname, (close - p - 1) * sizeof (CHAR));
|
||||
*(ccname + (close - p - 1)) = L('\0');
|
||||
/* As a result of a POSIX discussion, char class names are
|
||||
allowed to be quoted (?) */
|
||||
DEQUOTE_PATHNAME (ccname);
|
||||
pc = IS_CCLASS (orig_test, (XCHAR *)ccname);
|
||||
}
|
||||
if (pc == -1)
|
||||
@@ -929,6 +934,7 @@ fprintf(stderr, "extmatch: flags = %d\n", flags);
|
||||
#undef PATSCAN
|
||||
#undef STRCOMPARE
|
||||
#undef EXTMATCH
|
||||
#undef DEQUOTE_PATHNAME
|
||||
#undef STRUCT
|
||||
#undef BRACKMATCH
|
||||
#undef STRCHR
|
||||
|
||||
@@ -260,6 +260,7 @@ is_cclass (c, name)
|
||||
#define PATSCAN glob_patscan
|
||||
#define STRCOMPARE strcompare
|
||||
#define EXTMATCH extmatch
|
||||
#define DEQUOTE_PATHNAME udequote_pathname
|
||||
#define STRUCT smat_struct
|
||||
#define STRCHR(S, C) strchr((S), (C))
|
||||
#define MEMCHR(S, C, N) memchr((S), (C), (N))
|
||||
@@ -500,6 +501,7 @@ posix_cclass_only (pattern)
|
||||
#define PATSCAN glob_patscan_wc
|
||||
#define STRCOMPARE wscompare
|
||||
#define EXTMATCH extmatch_wc
|
||||
#define DEQUOTE_PATHNAME wcdequote_pathname
|
||||
#define STRUCT wcsmat_struct
|
||||
#define STRCHR(S, C) wcschr((S), (C))
|
||||
#define MEMCHR(S, C, N) wmemchr((S), (C), (N))
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ sh_regmatch (string, pattern, flags)
|
||||
#endif
|
||||
|
||||
rflags = REG_EXTENDED;
|
||||
if (glob_ignore_case || match_ignore_case)
|
||||
if (match_ignore_case)
|
||||
rflags |= REG_ICASE;
|
||||
#if !defined (ARRAY_VARS)
|
||||
rflags |= REG_NOSUB;
|
||||
|
||||
Reference in New Issue
Block a user