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 that has a header line starting with X-MS-, the headerline is
supressed because there is no key for this header. This looks supressed because there is no key for this header. This looks
like a new kind of M$ standard. mbnews crashed on this one. like a new kind of M$ standard. mbnews crashed on this one.
Fixed a small problem in magic filename testing.
mbfile: mbfile:
The mbfile index command now creates the html pages using the 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 (fread(&magic, magichdr.recsize, 1, FeM) == 1) {
if ((magic.Active) && (magic.Attrib == Typ) && if ((magic.Active) && (magic.Attrib == Typ) && (strcasecmp(magic.From, TIC.TicIn.Area) == 0)) {
(strcmp(magic.From, TIC.TicIn.Area) == 0)) {
/* /*
* Comparing of the filename must be done in * 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)) { if (strlen(magic.Mask) == strlen(TIC.NewName)) {
for (i = 0; i < strlen(magic.Mask); i++) { for (i = 0; i < strlen(magic.Mask); i++) {
switch (magic.Mask[i]) { switch (magic.Mask[i]) {
case '?': case '?': break;
case '@': if (!isalpha(TIC.NewName[i]))
DoMagic = FALSE;
break; break;
case '#': if (!isdigit(TIC.NewName[i]))
case '@':
if ((TIC.NewName[i] < 'a') || (TIC.NewName[i] > 'z'))
DoMagic = FALSE; DoMagic = FALSE;
break; break;
case '#': default: if (toupper(TIC.NewName[i]) != toupper(magic.Mask[i]))
if ((TIC.NewName[i] < '0') || (TIC.NewName[i] > '9'))
DoMagic = FALSE;
break;
default:
if (TIC.NewName[i] != magic.Mask[i])
DoMagic = FALSE; DoMagic = FALSE;
} }
} }
} else {
DoMagic = FALSE;
} }
if (DoMagic) { if (DoMagic) {