Mail Archives: djgpp/2006/11/30/00:47:33
fOn Wed, 29 Nov 2006 11:34:38 -0500 in comp.os.msdos.djgpp, DJ Delorie
<dj AT delorie DOT com> wrote:
>
>> This function indicates if STRING matches the PATTERN. ..."
>>
>> So DJGPP says that "\" doesn't match "\\" while Linux says it does.
>>
>> Well, I say DJGPP is right as the pattern says there should be two
>> backslashes and you only provide one.
>
>Except that PATTERN is a regex influenced by FNM_NOESCAPE and
>FNM_PATHNAME, and STRING isn't. So a pattern of "\\" is a single
>escaped backslash, whereas a string of "\" is a single backslash.
>They should match.
switch ((c = *pattern++))
{
...
...
...
case '\\':
/*+++ pattern already post-incremented to point to next char */
if (!(flags & FNM_NOESCAPE) && pattern[1] && strchr("*?[\\",
pattern[1]))
/*+++ should be:
if (!(flags & FNM_NOESCAPE) && strchr("*?[\\", *pattern))
*+++ as end of input pattern will match end char in escapes string */
{
/*+++ end of input pattern might be clearer with ! or == '\0' */
if ((c = *pattern++) == 0)
{
c = '\\';
--pattern;
}
if (c != *string++)
return FNM_NOMATCH;
break;
}
--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada
Brian DOT Inglis AT CSi DOT com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
fake address use address above to reply
- Raw text -