Added new filecase test function
This commit is contained in:
parent
81aa0911a5
commit
edad301e0a
@ -11,6 +11,11 @@ v0.37.2 23-Feb-2003.
|
|||||||
System prepared for setting the official FTSC product code,
|
System prepared for setting the official FTSC product code,
|
||||||
this will be 0x11FF. The code is not yet activated.
|
this will be 0x11FF. The code is not yet activated.
|
||||||
|
|
||||||
|
common.a:
|
||||||
|
New function to get the real case of a filename.
|
||||||
|
|
||||||
|
mbfido:
|
||||||
|
Finding the inbound tic file now uses the new function.
|
||||||
|
|
||||||
|
|
||||||
v0.37.1 14-Jan-2003 - 23-Feb-2003
|
v0.37.1 14-Jan-2003 - 23-Feb-2003
|
||||||
|
@ -283,6 +283,8 @@ long file_crc(char *path, int);
|
|||||||
time_t file_time(char *path);
|
time_t file_time(char *path);
|
||||||
int mkdirs(char *name, mode_t);
|
int mkdirs(char *name, mode_t);
|
||||||
int diskfree(int);
|
int diskfree(int);
|
||||||
|
int getfilecase(char *, char *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
33
lib/mbfile.c
33
lib/mbfile.c
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Basic File I/O
|
* Purpose ...............: Basic File I/O
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -346,3 +346,34 @@ int diskfree(int needed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Give a directory path and a filename, locate that filename in that
|
||||||
|
* directory and return the filename with the correct case. This is
|
||||||
|
* to be able to detect filename.ext, FILENAME.EXT and FiLeNaMe.ExT
|
||||||
|
*/
|
||||||
|
int getfilecase(char *path, char *file)
|
||||||
|
{
|
||||||
|
DIR *dp;
|
||||||
|
struct dirent *de;
|
||||||
|
int i, rc = FALSE;
|
||||||
|
|
||||||
|
if ((dp = opendir(path)) == NULL) {
|
||||||
|
WriteError("$Can't opendir(%s)", path);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((de = readdir(dp))) {
|
||||||
|
if (strcasecmp(de->d_name, file) == 0) {
|
||||||
|
for (i = 0; i < strlen(de->d_name); i++)
|
||||||
|
file[i] = de->d_name[i];
|
||||||
|
rc = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(dp);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
52
mbfido/tic.c
52
mbfido/tic.c
@ -168,8 +168,8 @@ int LoadTic(char *inb, char *tfn)
|
|||||||
char *Temp, *Temp2, *Buf, *Log = NULL, RealName[256];
|
char *Temp, *Temp2, *Buf, *Log = NULL, RealName[256];
|
||||||
int i, j, rc, bufsize, DescCnt = FALSE;
|
int i, j, rc, bufsize, DescCnt = FALSE;
|
||||||
fa_list *sbl = NULL;
|
fa_list *sbl = NULL;
|
||||||
DIR *dp;
|
// DIR *dp;
|
||||||
struct dirent *de;
|
// struct dirent *de;
|
||||||
|
|
||||||
if (CFG.slow_util && do_quiet)
|
if (CFG.slow_util && do_quiet)
|
||||||
usleep(1);
|
usleep(1);
|
||||||
@ -427,27 +427,36 @@ int LoadTic(char *inb, char *tfn)
|
|||||||
* Find out what the real name of the file is,
|
* Find out what the real name of the file is,
|
||||||
* most likely this is a 8.3 filename.
|
* most likely this is a 8.3 filename.
|
||||||
*/
|
*/
|
||||||
if ((dp = opendir(TIC.Inbound)) == NULL) {
|
// if ((dp = opendir(TIC.Inbound)) == NULL) {
|
||||||
WriteError("$Can't opendir(%s)", TIC.Inbound);
|
// WriteError("$Can't opendir(%s)", TIC.Inbound);
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
while ((de = readdir(dp))) {
|
// while ((de = readdir(dp))) {
|
||||||
/*
|
// /*
|
||||||
* Check 8.3 FN
|
// * Check 8.3 FN
|
||||||
*/
|
// */
|
||||||
if (strcasecmp(de->d_name, TIC.TicIn.File) == 0) {
|
// if (strcasecmp(de->d_name, TIC.TicIn.File) == 0) {
|
||||||
strncpy(RealName, de->d_name, 255);
|
// strncpy(RealName, de->d_name, 255);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
/*
|
// /*
|
||||||
* Check LFN
|
// * Check LFN
|
||||||
*/
|
// */
|
||||||
if (strcasecmp(de->d_name, TIC.TicIn.FullName) == 0) {
|
// if (strcasecmp(de->d_name, TIC.TicIn.FullName) == 0) {
|
||||||
strncpy(RealName, de->d_name, 255);
|
// strncpy(RealName, de->d_name, 255);
|
||||||
break;
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// closedir(dp);
|
||||||
|
strncpy(RealName, TIC.TicIn.File, 255);
|
||||||
|
Syslog('f', "getfilecase(%s, %s)", TIC.Inbound, RealName);
|
||||||
|
if (! getfilecase(TIC.Inbound, RealName)) {
|
||||||
|
strncpy(RealName, TIC.TicIn.FullName, 255);
|
||||||
|
Syslog('f', "getfilecase(%s, %s)", TIC.Inbound, RealName);
|
||||||
|
if (! getfilecase(TIC.Inbound, RealName)) {
|
||||||
|
memset(&RealName, 0, sizeof(RealName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(RealName) == 0) {
|
if (strlen(RealName) == 0) {
|
||||||
@ -458,6 +467,7 @@ int LoadTic(char *inb, char *tfn)
|
|||||||
TIC.Orphaned = TRUE;
|
TIC.Orphaned = TRUE;
|
||||||
WriteError("Can't find file in inbound");
|
WriteError("Can't find file in inbound");
|
||||||
} else {
|
} else {
|
||||||
|
Syslog('f', "Returned RealName %s", RealName);
|
||||||
/*
|
/*
|
||||||
* If no LFN received in the ticfile and the file in the inbound is the same as the 8.3 name
|
* If no LFN received in the ticfile and the file in the inbound is the same as the 8.3 name
|
||||||
* but only the case is different, then treat the real filename as LFN.
|
* but only the case is different, then treat the real filename as LFN.
|
||||||
|
Reference in New Issue
Block a user