Prepared Add_BBS function for un_attach

This commit is contained in:
Michiel Broek 2004-07-16 20:07:46 +00:00
parent 0b04760570
commit 3506f477d5
2 changed files with 24 additions and 13 deletions

View File

@ -124,7 +124,7 @@ depend:
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
addbbs.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h tic.h fsort.h addbbs.h
addbbs.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h tic.h fsort.h qualify.h addbbs.h
backalias.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h backalias.h
flock.o: ../config.h ../lib/mbselib.h flock.h
hatch.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h utic.h rollover.h hatch.h

View File

@ -34,6 +34,7 @@
#include "../lib/mbsedb.h"
#include "tic.h"
#include "fsort.h"
#include "qualify.h"
#include "addbbs.h"
@ -55,6 +56,7 @@ int Add_BBS()
char temp1[PATH_MAX], temp2[PATH_MAX], *fname, *lname, *p;
fd_list *fdl = NULL;
struct _fdbarea *fdb_area = NULL;
qualify *tmpq;
/*
* First check for an existing record with the same filename,
@ -273,20 +275,29 @@ int Add_BBS()
*/
if (DidDelete) {
if ((fdb_area = mbsedb_OpenFDB(tic.FileArea, 30))) {
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1)
if (fdb.Deleted) {
sprintf(temp2, "%s/%s", area.Path, fdb.LName);
if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2);
sprintf(temp2, "%s/%s", area.Path, fdb.Name);
if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2);
sprintf(temp2, "%s/.%s", area.Path, fdb.Name);
unlink(temp2); /* Thumbnail, no logging if there is an error */
}
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
if (fdb.Deleted) {
sprintf(temp2, "%s/%s", area.Path, fdb.LName);
if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2);
sprintf(temp2, "%s/%s", area.Path, fdb.Name);
/*
* With the path to the 8.3 name, we can check if this file
* is attached for any possible downlink.
* We must get the qualify list passed so we have a quick systems list.
*/
if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2);
sprintf(temp2, "%s/.%s", area.Path, fdb.Name);
unlink(temp2); /* Thumbnail, no logging if there is an error */
}
mbsedb_PackFDB(fdb_area);
mbsedb_CloseFDB(fdb_area);
DidDelete = FALSE;
DidDelete = FALSE;
}
}
}