mirror of
https://github.com/cc65/cc65.git
synced 2024-12-22 12:30:41 +00:00
isequal with --wildcard: Allow DOS/Win paths
Allow a colon (':') at the second position of a DOS or Windows path, so a path with drive specifier (i.e., "c:") is recognized as a path of the wildcard should end with a colon.
This commit is contained in:
parent
a7b2a92fc2
commit
6b7d23ca74
@ -349,18 +349,37 @@ static int processwildcardchar(FILE *f1)
|
||||
static int wildcard_path(FILE * f2)
|
||||
{
|
||||
int isstillwildcard = 1;
|
||||
static int allowedcolonin = 2;
|
||||
|
||||
int ch = getnext(f2);
|
||||
|
||||
if (allowedcolonin >= 0) {
|
||||
--allowedcolonin;
|
||||
}
|
||||
|
||||
if ((ch == wildcardendchar) || ch < ' ' || ch > 126) {
|
||||
/* this is not a path char anymore, abort the wildcard processing */
|
||||
isstillwildcard = 0;
|
||||
|
||||
if (ch != wildcardendchar) {
|
||||
exit(EXIT_FAILURE);
|
||||
/* first of all, ignore a colon at position 2 if it is the wildcardendchar.
|
||||
* This is needed for windows path specifications, which can begin with
|
||||
* a drive specifier and a colon.
|
||||
*/
|
||||
|
||||
if ( (allowedcolonin >= 0) && (ch == ':') ) {
|
||||
fprintf(stderr, "Ignoring ':' at drive specifier, do not end the path here!\n");
|
||||
}
|
||||
else {
|
||||
isstillwildcard = 0;
|
||||
|
||||
allowedcolonin = 2;
|
||||
|
||||
if (ch != wildcardendchar) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return isstillwildcard;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user