Mail Archives: djgpp-workers/1999/04/11/08:33:48
On Tue, 6 Apr 1999, Michel de Ruiter wrote:
> Also, I noticed `abC*' expands to `ABC', whereas `aBc*'
> expands to `abc'. Why?
The patch that corrects this is attached below. It will be part
of DJGPP v2.03.
Note that I did nothing to handle the case of */, since there seem
to be no agreement in how different shells handle it.
*** djgpp/src/libc/posix/glob/glob.c.~1~ Sun Sep 27 17:52:52 1998
--- djgpp/src/libc/posix/glob/glob.c Sun Apr 11 15:23:14 1999
***************
*** 79,85 ****
{
if (*rest)
{
! if (glob2(rest, epathbuf, lower, caseless) == GLOB_NOSPACE)
return GLOB_NOSPACE;
}
else
--- 79,86 ----
{
if (*rest)
{
! if (glob2(rest, epathbuf, preserve_case ? 0 : 1,
! preserve_case ? 0 : 1) == GLOB_NOSPACE)
return GLOB_NOSPACE;
}
else
***************
*** 128,134 ****
wildcard_nesting++;
if (*rest)
{
! if (glob2(rest, tp, lower, caseless) == GLOB_NOSPACE)
return GLOB_NOSPACE;
}
else
--- 129,136 ----
wildcard_nesting++;
if (*rest)
{
! if (glob2(rest, tp, preserve_case ? 0 : 1,
! preserve_case ? 0 : 1) == GLOB_NOSPACE)
return GLOB_NOSPACE;
}
else
***************
*** 140,146 ****
tp[-1] = slash;
}
*tp = 0;
! if (glob_dirs(rest, tp, 0, lower, caseless) == GLOB_NOSPACE)
return GLOB_NOSPACE;
wildcard_nesting--;
}
--- 142,149 ----
tp[-1] = slash;
}
*tp = 0;
! if (glob_dirs(rest, tp, 0, preserve_case ? 0 : 1,
! preserve_case ? 0 : 1) == GLOB_NOSPACE)
return GLOB_NOSPACE;
wildcard_nesting--;
}
***************
*** 161,172 ****
if (strcmp(pattern, "...") == 0)
{
! return glob_dirs(pattern+3, epathbuf, 1, lower, caseless);
}
if (strncmp(pattern, "...", 3) == 0 && (pattern[3] == '\\' || pattern[3] == '/'))
{
slash = pattern[3];
! return glob_dirs(pattern+4, epathbuf, 1, lower, caseless);
}
*epathbuf = 0;
--- 164,177 ----
if (strcmp(pattern, "...") == 0)
{
! return glob_dirs(pattern+3, epathbuf, 1,
! preserve_case ? 0 : 1, preserve_case ? 0 : 1);
}
if (strncmp(pattern, "...", 3) == 0 && (pattern[3] == '\\' || pattern[3] == '/'))
{
slash = pattern[3];
! return glob_dirs(pattern+4, epathbuf, 1,
! preserve_case ? 0 : 1, preserve_case ? 0 : 1);
}
*epathbuf = 0;
***************
*** 179,184 ****
--- 184,190 ----
if (*pp == ':' || *pp == '\\' || *pp == '/')
{
pslash = bp;
+ caseless = lower = preserve_case ? 0 : 1;
if (strcmp(pp+1, "...") == 0
|| (strncmp(pp+1, "...", 3) == 0 && (pp[4] == '/' || pp[4] == '\\')))
{
***************
*** 215,222 ****
caseless = 0;
lower = 0;
}
- else if (*pp >= 'a' && *pp <= 'z')
- lower = 1;
}
*bp++ = *pp++;
--- 221,226 ----
***************
*** 262,269 ****
caseless = 0;
lower = 0;
}
- else if (*pslash >= 'a' && *pslash <= 'z')
- lower = 1;
}
if (*pslash)
--- 266,271 ----
***************
*** 278,284 ****
if (strcmp(my_pattern, "...") == 0)
{
! if (glob_dirs(*pslash ? pslash+1 : pslash, bp, 1, lower, caseless) == GLOB_NOSPACE)
return GLOB_NOSPACE;
return 0;
}
--- 280,287 ----
if (strcmp(my_pattern, "...") == 0)
{
! if (glob_dirs(*pslash ? pslash+1 : pslash, bp, 1, preserve_case ? 0 : 1,
! preserve_case ? 0 : 1) == GLOB_NOSPACE)
return GLOB_NOSPACE;
return 0;
}
***************
*** 310,316 ****
*tp = 0;
/* printf("nest: `%s' `%s'\n", pslash+1, pathbuf); */
wildcard_nesting++;
! if (glob2(pslash+1, tp, lower, caseless) == GLOB_NOSPACE)
return GLOB_NOSPACE;
wildcard_nesting--;
}
--- 313,320 ----
*tp = 0;
/* printf("nest: `%s' `%s'\n", pslash+1, pathbuf); */
wildcard_nesting++;
! if (glob2(pslash+1, tp, preserve_case ? 0 : 1,
! preserve_case ? 0 : 1) == GLOB_NOSPACE)
return GLOB_NOSPACE;
wildcard_nesting--;
}
***************
*** 352,358 ****
wildcard_nesting = 0;
save_count = 0;
save_list = 0;
! use_lfn = _USE_LFN;
preserve_case = _preserve_fncase();
slash = '/';
--- 356,362 ----
wildcard_nesting = 0;
save_count = 0;
save_list = 0;
! use_lfn = _use_lfn(_pattern);
preserve_case = _preserve_fncase();
slash = '/';
- Raw text -