Added some experimental code for tic orphans processing

This commit is contained in:
Michiel Broek 2005-11-13 20:45:25 +00:00
parent faf5c18a67
commit 75b6e42acd
3 changed files with 34 additions and 14 deletions

View File

@ -2,6 +2,8 @@ $Id$
v0.83.1 12-Nov-2005
mbfido:
Added some experimental code for tic orphans processing.
v0.83.0 06-Nov-2005 - 12-Nov-2005

View File

@ -68,8 +68,8 @@ extern int check_dupe;
*/
int ProcessTic(fa_list **sbl, orphans **opl)
{
time_t Now, Fdate;
int Age, First, Listed = FALSE, DownLinks = 0, MustRearc = FALSE;
time_t Now;
int First, Listed = FALSE, DownLinks = 0, MustRearc = FALSE;
int UnPacked = FALSE, IsArchive = FALSE, rc, i, j, k, File_Id = FALSE;
char *Temp, *unarc = NULL, *cmd = NULL;
char temp1[PATH_MAX], temp2[PATH_MAX], sbe[24], TDesc[256];
@ -80,6 +80,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
int BBS_Imp = FALSE, DidBanner = FALSE;
faddr *p_from;
qualify *qal = NULL, *tmpq;
orphans *topl;
Now = time(NULL);
@ -98,19 +99,20 @@ int ProcessTic(fa_list **sbl, orphans **opl)
}
if (TIC.Orphaned) {
WriteError("File not in inbound: %s", TIC.TicIn.File);
fill_orphans(opl, TIC.TicName, TIC.TicIn.Area, TIC.TicIn.File, TRUE, FALSE);
Syslog('+', "File not in inbound: %s", TIC.TicIn.File);
/*
* Now check the age of the .tic file.
*/
snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicName);
Fdate = file_time(Temp);
Age = (Now - Fdate) / 84400;
Syslog('+', "Orphaned tic age %d days", Age);
// snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicName);
// Fdate = file_time(Temp);
// Age = (Now - Fdate) / 84400;
// Syslog('+', "Orphaned tic age %d days", Age);
if (Age > 21) {
tic_bad++;
mover(TIC.TicName);
}
// if (Age > 21) {
// tic_bad++;
// mover(TIC.TicName);
// }
free(Temp);
return 2;
@ -134,8 +136,10 @@ int ProcessTic(fa_list **sbl, orphans **opl)
if (TIC.Crc_Int) {
if (crc != TIC.Crc_Int) {
Syslog('!', "CRC: expected %08lX, the file is %08lX", TIC.Crc_Int, crc);
fill_orphans(opl, TIC.TicName, TIC.TicIn.Area, TIC.TicIn.File, FALSE, TRUE);
if (check_crc) {
Bad((char *)"CRC: error, %s may be damaged", TIC.TicIn.File);
// Bad((char *)"CRC: error, %s may be damaged", TIC.TicIn.File);
Syslog('+', "Bad CRC, will check this ticfile later");
free(Temp);
return 1;
} else {
@ -577,6 +581,15 @@ int ProcessTic(fa_list **sbl, orphans **opl)
}
} /* not get FILE_ID.DIZ */
/*
* Now check if other (older) ticfiles point to this file
*/
for (topl = *opl; topl; topl = topl->next) {
if ((strcmp(topl->Area, TIC.TicIn.Area) == 0) && (strcmp(topl->FileName, TIC.TicIn.File) == 0)) {
Syslog('f', "Found matching tic file %s, should purge this one", topl->TicName);
}
}
/*
* Rearc file if it is an unpacked archive.
*/

View File

@ -66,7 +66,7 @@ int Tic()
struct stat sbuf;
int i, rc = 0;
fd_list *fdl = NULL;
orphans *opl = NULL;
orphans *opl = NULL, *tmp;
IsDoing("Process .tic files");
CompileNL = FALSE;
@ -152,6 +152,11 @@ int Tic()
if (CompileNL)
CreateSema((char *)"mbindex");
Syslog('f', "start tidy_orphans()");
for (tmp = opl; tmp; tmp = opl->next) {
Syslog('f', "%-12s %-20s %-12s %s %s", tmp->TicName, tmp->Area, tmp->FileName,
tmp->Orphaned ? "ORP" : "n/a", tmp->BadCRC ? "CRC" : "n/a");
}
tidy_orphans(&opl);
free(inbound);
@ -452,7 +457,7 @@ int LoadTic(char *inb, char *tfn, orphans **opl)
* will handle this orphaned tic file.
*/
TIC.Orphaned = TRUE;
WriteError("Can't find file in inbound");
Syslog('+', "Can't find file in inbound, will check later");
} else {
Syslog('f', "Returned RealName %s", RealName);
/*