Code cleanup

This commit is contained in:
Michiel Broek 2002-10-28 12:21:06 +00:00
parent 7df384eec8
commit c8c54ea185

View File

@ -73,11 +73,8 @@ extern int check_dupe;
int ProcessTic(fa_list *sbl) int ProcessTic(fa_list *sbl)
{ {
time_t Now, Fdate; time_t Now, Fdate;
int Age, First, Listed = FALSE; int Age, First, Listed = FALSE, DownLinks = 0, MustRearc = FALSE;
int DownLinks = 0; int UnPacked = FALSE, IsArchive = FALSE, rc, i, j, k, File_Id = FALSE;
int MustRearc = FALSE;
int UnPacked = FALSE, IsArchive = FALSE;
int rc, i, j, k, File_Id = FALSE;
char *Temp, *unarc = NULL, *cmd = NULL; char *Temp, *unarc = NULL, *cmd = NULL;
char temp1[PATH_MAX], temp2[PATH_MAX], sbe[24], TDesc[256]; char temp1[PATH_MAX], temp2[PATH_MAX], sbe[24], TDesc[256];
unsigned long crc, crc2, Kb; unsigned long crc, crc2, Kb;
@ -184,11 +181,8 @@ int ProcessTic(fa_list *sbl)
while (GetTicSystem(&Link, First)) { while (GetTicSystem(&Link, First)) {
First = FALSE; First = FALSE;
if (Link.aka.zone) { if (Link.aka.zone) {
if ((Link.aka.zone == TIC.Aka.zone) && if ((Link.aka.zone == TIC.Aka.zone) && (Link.aka.net == TIC.Aka.net) &&
(Link.aka.net == TIC.Aka.net) && (Link.aka.node == TIC.Aka.node) && (Link.aka.point== TIC.Aka.point) && (Link.receivefrom))
(Link.aka.node == TIC.Aka.node) &&
(Link.aka.point== TIC.Aka.point) &&
(Link.receivefrom))
Listed = TRUE; Listed = TRUE;
} }
} }
@ -332,8 +326,7 @@ int ProcessTic(fa_list *sbl)
FwdSize = fgroup.UnitSize; FwdSize = fgroup.UnitSize;
/* /*
* If FwdSize <> 0 then calculate per size, else * If FwdSize <> 0 then calculate per size, else charge for each file.
* charge for each file.
*/ */
if (FwdSize) if (FwdSize)
TIC.FileCost = ((TIC.FileSize / 1024) / FwdSize) * FwdCost; TIC.FileCost = ((TIC.FileSize / 1024) / FwdSize) * FwdCost;
@ -426,8 +419,7 @@ int ProcessTic(fa_list *sbl)
if ((tic.VirScan || MustRearc) && IsArchive) { if ((tic.VirScan || MustRearc) && IsArchive) {
/* /*
* Check if there is a temp directory for the archive * Check if there is a temp directory for the archive conversion.
* conversion.
*/ */
sprintf(temp2, "%s/tmp/arc", getenv("MBSE_ROOT")); sprintf(temp2, "%s/tmp/arc", getenv("MBSE_ROOT"));
if ((access(temp2, R_OK)) != 0) { if ((access(temp2, R_OK)) != 0) {
@ -562,14 +554,12 @@ int ProcessTic(fa_list *sbl)
sprintf(temp1, "%s/tmp", getenv("MBSE_ROOT")); sprintf(temp1, "%s/tmp", getenv("MBSE_ROOT"));
chdir(temp1); chdir(temp1);
sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.RealName); sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
(char *)"/dev/null", (char *)"/dev/null") == 0) {
sync(); sync();
File_Id = TRUE; File_Id = TRUE;
} else { } else {
sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.RealName); sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.RealName);
if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", if (execute(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
(char *)"/dev/null", (char *)"/dev/null") == 0) {
sync(); sync();
File_Id = TRUE; File_Id = TRUE;
} }
@ -592,8 +582,7 @@ int ProcessTic(fa_list *sbl)
TIC.File_Id_Ct = TIC.TicIn.TotLDesc; TIC.File_Id_Ct = TIC.TicIn.TotLDesc;
} else { } else {
/* /*
* Format the description line (max 255 chars) * Format the description line (max 255 chars) in parts of 48 characters.
* in parts of 48 characters.
*/ */
if (strlen(TIC.TicIn.Desc) <= 48) { if (strlen(TIC.TicIn.Desc) <= 48) {
strcpy(TIC.File_Id[0], TIC.TicIn.Desc); strcpy(TIC.File_Id[0], TIC.TicIn.Desc);
@ -640,8 +629,7 @@ int ProcessTic(fa_list *sbl)
T_File.Size = TIC.FileSize; T_File.Size = TIC.FileSize;
T_File.SizeKb = TIC.FileSize / 1024; T_File.SizeKb = TIC.FileSize / 1024;
/* /*
* Calculate the CRC if we must send the new * Calculate the CRC if we must send the new archived file.
* archived file.
*/ */
if (!TIC.SendOrg) { if (!TIC.SendOrg) {
ReCalcCrc(temp1); ReCalcCrc(temp1);