magic filename testing improved

This commit is contained in:
Michiel Broek 2002-04-18 20:32:57 +00:00
parent ed55db1d62
commit 8876336125
2 changed files with 59 additions and 63 deletions

View File

@ -4717,6 +4717,7 @@ v0.33.20 10-Feb-2002
that has a header line starting with X-MS-, the headerline is
supressed because there is no key for this header. This looks
like a new kind of M$ standard. mbnews crashed on this one.
Fixed a small problem in magic filename testing.
mbfile:
The mbfile index command now creates the html pages using the

View File

@ -130,8 +130,7 @@ int GetMagicRec(int Typ, int First)
if (fread(&magic, magichdr.recsize, 1, FeM) == 1) {
if ((magic.Active) && (magic.Attrib == Typ) &&
(strcmp(magic.From, TIC.TicIn.Area) == 0)) {
if ((magic.Active) && (magic.Attrib == Typ) && (strcasecmp(magic.From, TIC.TicIn.Area) == 0)) {
/*
* Comparing of the filename must be done in
@ -140,24 +139,20 @@ int GetMagicRec(int Typ, int First)
if (strlen(magic.Mask) == strlen(TIC.NewName)) {
for (i = 0; i < strlen(magic.Mask); i++) {
switch (magic.Mask[i]) {
case '?':
case '?': break;
case '@': if (!isalpha(TIC.NewName[i]))
DoMagic = FALSE;
break;
case '@':
if ((TIC.NewName[i] < 'a') || (TIC.NewName[i] > 'z'))
case '#': if (!isdigit(TIC.NewName[i]))
DoMagic = FALSE;
break;
case '#':
if ((TIC.NewName[i] < '0') || (TIC.NewName[i] > '9'))
DoMagic = FALSE;
break;
default:
if (TIC.NewName[i] != magic.Mask[i])
default: if (toupper(TIC.NewName[i]) != toupper(magic.Mask[i]))
DoMagic = FALSE;
}
}
} else {
DoMagic = FALSE;
}
if (DoMagic) {