Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
bc6cdf65
...
bc6cdf65cf26b9c2bdedbbe39e1ea79ae4e23742
authored
2002-04-10 13:23:41 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(util_wcard_match): from list.c
1 parent
bfc095f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
imap4d/util.c
imap4d/util.c
View file @
bc6cdf6
...
...
@@ -891,3 +891,52 @@ util_localname ()
}
return
localname
;
}
/* Match STRING against the IMAP4 wildard pattern PATTERN */
int
util_wcard_match
(
const
char
*
string
,
const
char
*
pattern
,
const
char
*
delim
)
{
const
char
*
p
=
pattern
,
*
n
=
string
;
char
c
;
for
(;(
c
=
*
p
++
)
!=
'\0'
&&
*
n
;
n
++
)
{
switch
(
c
)
{
case
'%'
:
if
(
*
p
==
'\0'
)
{
/* Matches everything except '/' */
for
(;
*
n
&&
*
n
!=
delim
[
0
];
n
++
)
;
return
(
*
n
==
delim
[
0
])
?
WCARD_RECURSE_MATCH
:
WCARD_MATCH
;
}
else
for
(;
*
n
!=
'\0'
;
++
n
)
if
(
util_wcard_match
(
n
,
p
,
delim
)
==
WCARD_MATCH
)
return
WCARD_MATCH
;
break
;
case
'*'
:
if
(
*
p
==
'\0'
)
return
WCARD_RECURSE_MATCH
;
for
(;
*
n
!=
'\0'
;
++
n
)
{
int
status
=
util_wcard_match
(
n
,
p
,
delim
);
if
(
status
==
WCARD_MATCH
||
status
==
WCARD_RECURSE_MATCH
)
return
status
;
}
break
;
default:
if
(
c
!=
*
n
)
return
WCARD_NOMATCH
;
}
}
if
(
!
c
&&
!*
n
)
return
WCARD_MATCH
;
return
WCARD_NOMATCH
;
}
...
...
Please
register
or
sign in
to post a comment