Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
07291056
Commit
07291056
authored
24 years ago
by
Andreas Mohr
Committed by
Alexandre Julliard
24 years ago
Browse files
Options
Downloads
Patches
Plain Diff
DOSFS_MatchLong ignored several things about file mask matching for
long file names.
parent
566e77ba
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/dos_fs.c
+59
-6
59 additions, 6 deletions
files/dos_fs.c
with
59 additions
and
6 deletions
files/dos_fs.c
+
59
−
6
View file @
07291056
...
...
@@ -289,10 +289,24 @@ static int DOSFS_MatchShort( const char *mask, const char *name )
* DOSFS_MatchLong
*
* Check a long file name against a mask.
*
* Tests (done in W95 DOS shell - case insensitive):
* *.txt test1.test.txt *
* *st1* test1.txt *
* *.t??????.t* test1.ta.tornado.txt *
* *tornado* test1.ta.tornado.txt *
* t*t test1.ta.tornado.txt *
* ?est* test1.txt *
* ?est??? test1.txt -
* *test1.txt* test1.txt *
* h?l?o*t.dat hellothisisatest.dat *
*/
static
int
DOSFS_MatchLong
(
const
char
*
mask
,
const
char
*
name
,
int
case_sensitive
)
{
const
char
*
lastjoker
=
NULL
;
const
char
*
next_to_retry
=
NULL
;
if
(
!
strcmp
(
mask
,
"*.*"
))
return
1
;
while
(
*
name
&&
*
mask
)
{
...
...
@@ -300,23 +314,62 @@ static int DOSFS_MatchLong( const char *mask, const char *name,
{
mask
++
;
while
(
*
mask
==
'*'
)
mask
++
;
/* Skip consecutive '*' */
if
(
!*
mask
)
return
1
;
lastjoker
=
mask
;
if
(
!*
mask
)
return
1
;
/* end of mask is all '*', so match */
/* skip to the next match after the joker(s) */
if
(
case_sensitive
)
while
(
*
name
&&
(
*
name
!=
*
mask
))
name
++
;
else
while
(
*
name
&&
(
toupper
(
*
name
)
!=
toupper
(
*
mask
)))
name
++
;
if
(
!*
name
)
break
;
next_to_retry
=
name
;
}
else
if
(
*
mask
!=
'?'
)
{
int
mismatch
=
0
;
if
(
case_sensitive
)
{
if
(
*
mask
!=
*
name
)
return
0
;
if
(
*
mask
!=
*
name
)
mismatch
=
1
;
}
else
if
(
toupper
(
*
mask
)
!=
toupper
(
*
name
))
return
0
;
else
{
if
(
toupper
(
*
mask
)
!=
toupper
(
*
name
))
mismatch
=
1
;
}
if
(
!
mismatch
)
{
mask
++
;
name
++
;
if
(
*
mask
==
'\0'
)
{
if
(
*
name
==
'\0'
)
return
1
;
if
(
lastjoker
)
mask
=
lastjoker
;
}
}
else
/* mismatch ! */
{
if
(
lastjoker
)
/* we had an '*', so we can try unlimitedly */
{
mask
=
lastjoker
;
/* this scan sequence was a mismatch, so restart
* 1 char after the first char we checked last time */
next_to_retry
++
;
name
=
next_to_retry
;
}
else
return
0
;
/* bad luck */
}
}
else
/* '?' */
{
mask
++
;
name
++
;
}
mask
++
;
name
++
;
}
if
(
*
mask
==
'.'
)
mask
++
;
/* Ignore trailing '.' in mask */
while
((
*
mask
==
'.'
)
||
(
*
mask
==
'*'
))
mask
++
;
/* Ignore trailing '.' or '*' in mask */
return
(
!*
name
&&
!*
mask
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment