From 0f5bfdcb0a5faab82bee08393dd4013b9ee0a22a Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 12 Nov 2005 12:32:47 +0000 Subject: [PATCH] Added orphaned list structure --- mbfido/Makefile | 11 +++++---- mbfido/orphans.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ mbfido/orphans.h | 22 +++++++++++++++++ mbfido/ptic.c | 1 + mbfido/tic.c | 1 + 5 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 mbfido/orphans.c create mode 100644 mbfido/orphans.h diff --git a/mbfido/Makefile b/mbfido/Makefile index 15f5e6f1..3cd522fd 100644 --- a/mbfido/Makefile +++ b/mbfido/Makefile @@ -14,7 +14,7 @@ SRCS = addbbs.c backalias.c flock.c hatch.c mbdiff.c mgrutil.c qualify.c \ hash.c mbaff.c mbseq.c notify.c postnetmail.c scannews.c tosspkt.c \ mbfkill.c mbfutil.c mbfindex.c mbfcheck.c mbfpack.c mbflist.c mbfadopt.c \ mbfimport.c mbfsort.c virscan.c mbftoberep.c mbfmove.c mbfdel.c bounce.c \ - createm.c createf.c msgflags.c dirsession.c queue.c dirlock.c msg.c + createm.c createf.c msgflags.c dirsession.c queue.c dirlock.c msg.c orphans.c HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h qualify.h \ postnetmail.h scannews.h tosspkt.h addpkt.h bwrite.h forward.h \ lhash.h mbfido.h mkftnhdr.h ptic.h sendmail.h tracker.h \ @@ -25,7 +25,7 @@ HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h qualify.h \ atoul.h filemgr.h hash.h mbaff.h mbseq.h notify.h postemail.h scan.h toberep.h \ mbfkill.h mbfutil.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfadopt.h \ mbfimport.h mbfsort.h virscan.h mbftoberep.h mbfmove.h mbfdel.h bounce.h \ - createm.h createf.h msgflags.h dirsession.h queue.h dirlock.h msg.h + createm.h createf.h msgflags.h dirsession.h queue.h dirlock.h msg.h orphans.h MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o tracker.o \ makestat.o scannews.o lhash.o bounce.o unpack.o tic.o ptic.o \ utic.o mover.o hash.o mkftnhdr.o addbbs.o magic.o fsort.o toberep.o \ @@ -33,7 +33,7 @@ MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o tracker.o storenet.o storeecho.o areamgr.o filemgr.o notify.o mgrutil.o rollover.o \ bwrite.o rfc2ftn.o rnews.o newspost.o aliasdb.o postemail.o postnetmail.o \ postecho.o backalias.o createm.o createf.o msgflags.o dirsession.o \ - queue.o dirlock.o qualify.o msg.o + queue.o dirlock.o qualify.o msg.o orphans.o MBSEQ_OBJS = mbseq.o MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o toberep.o MBINDEX_OBJS = mbindex.o @@ -131,7 +131,7 @@ hatch.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h utic.h roll mbdiff.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbdiff.h mgrutil.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/diesel.h sendmail.h rollover.h addpkt.h createm.h createf.h mgrutil.h qualify.o: ../config.h ../lib/mbselib.h qualify.h -ptic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h mover.h toberep.h tic.h utic.h magic.h forward.h rollover.h ptic.h magic.h createf.h virscan.h qualify.h addbbs.h +ptic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h mover.h toberep.h tic.h utic.h magic.h forward.h rollover.h ptic.h magic.h createf.h virscan.h qualify.h orphans.h addbbs.h sendmail.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h rollover.h sendmail.h tracker.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h tracker.h addpkt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h @@ -162,7 +162,7 @@ mbindex.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbindex.h msgutil.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h postecho.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h qualify.h rollover.o: ../config.h ../lib/mbselib.h rollover.h -tic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h ptic.h fsort.h tic.h +tic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h ptic.h fsort.h orphans.h tic.h areamgr.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h ../lib/diesel.h sendmail.h mgrutil.h scan.h createm.h areamgr.h filefind.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h grlist.o: ../config.h ../lib/mbselib.h grlist.h @@ -202,4 +202,5 @@ dirsession.o: ../config.h ../lib/mbselib.h dirsession.h queue.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h fsort.h dirsession.h queue.h dirlock.o: ../config.h ../lib/mbselib.h flock.h dirlock.h msg.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/msgtext.h ../lib/msg.h msgflags.h msg.h +orphans.o: ../config.h ../lib/mbselib.h orphans.h # End of generated dependencies diff --git a/mbfido/orphans.c b/mbfido/orphans.c new file mode 100644 index 00000000..6dc8a1b1 --- /dev/null +++ b/mbfido/orphans.c @@ -0,0 +1,64 @@ +/***************************************************************************** + * + * $Id$ + * Purpose ...............: List of orphaned ticfiles + * + ***************************************************************************** + * Copyright (C) 1997-2005 + * + * Michiel Broek FIDO: 2:280/2802 + * Beekmansbos 10 + * 1971 BV IJmuiden + * the Netherlands + * + * This file is part of MBSE BBS. + * + * This BBS is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * MBSE BBS is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MBSE BBS; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +#include "../config.h" +#include "../lib/mbselib.h" +#include "orphans.h" + + + +void tidy_orphans(orphans **qal) +{ + orphans *tmp, *old; + + for (tmp = *qal; tmp; tmp = old) { + old = tmp->next; + free(tmp); + } + *qal = NULL; +} + + + +void fill_orphans(orphans **qal, char *TicName, char *Area, char *FileName, int Orphaned, int BadCRC) +{ + orphans *tmp; + + tmp = (orphans *)malloc(sizeof(orphans)); + snprintf(tmp->TicName, 13, TicName); + snprintf(tmp->Area, 21, Area); + snprintf(tmp->FileName, 81, FileName); + tmp->Orphaned = Orphaned; + tmp->BadCRC = BadCRC; + tmp->Purged = FALSE; + *qal = tmp; +} + + diff --git a/mbfido/orphans.h b/mbfido/orphans.h new file mode 100644 index 00000000..fa1d0cbd --- /dev/null +++ b/mbfido/orphans.h @@ -0,0 +1,22 @@ +#ifndef _ORPHANS_H +#define _ORPHANS_H + +/* $Id$ */ + +/* + * Linked list of orpaned ticfiles. + */ +typedef struct _orphans { + struct _orphans *next; /* Linked list */ + char TicName[13]; /* TIC filename */ + char Area[21]; /* TIC area */ + char FileName[81]; /* TIC filename */ + unsigned Orphaned : 1; /* Real orphaned file */ + unsigned BadCRC : 1; /* Present but wrong crc */ + unsigned Purged : 1; /* Can be purged */ +} orphans; + +void tidy_orphans(orphans **); +void fill_orphans(orphans **, char *, char *, char *, int, int); + +#endif diff --git a/mbfido/ptic.c b/mbfido/ptic.c index 1f721084..76a045c9 100644 --- a/mbfido/ptic.c +++ b/mbfido/ptic.c @@ -45,6 +45,7 @@ #include "createf.h" #include "virscan.h" #include "qualify.h" +#include "orphans.h" #include "addbbs.h" diff --git a/mbfido/tic.c b/mbfido/tic.c index f1f2824b..8d8f558d 100644 --- a/mbfido/tic.c +++ b/mbfido/tic.c @@ -35,6 +35,7 @@ #include "unpack.h" #include "ptic.h" #include "fsort.h" +#include "orphans.h" #include "tic.h" #define UNPACK_FACTOR 300