From 75b6e42acdb7b462f56c10f28966499a4c493c38 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 13 Nov 2005 20:45:25 +0000 Subject: [PATCH] Added some experimental code for tic orphans processing --- ChangeLog | 2 ++ mbfido/ptic.c | 37 +++++++++++++++++++++++++------------ mbfido/tic.c | 9 +++++++-- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c134e86..e1c3b908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/mbfido/ptic.c b/mbfido/ptic.c index ed57f27f..212af252 100644 --- a/mbfido/ptic.c +++ b/mbfido/ptic.c @@ -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. */ diff --git a/mbfido/tic.c b/mbfido/tic.c index c6015d15..947ff952 100644 --- a/mbfido/tic.c +++ b/mbfido/tic.c @@ -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); /*