Added auto file areas create/delete

This commit is contained in:
Michiel Broek
2002-04-28 14:27:23 +00:00
parent 4c28c270d0
commit 9b934614d0
7 changed files with 260 additions and 42 deletions

View File

@@ -10,7 +10,7 @@
* MBSE BBS and utilities.
*
*****************************************************************************
* Copyright (C) 1997-2001
* Copyright (C) 1997-2002
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -312,6 +312,28 @@ int JAM_Delete(unsigned long ulMsg)
/*
* Delete JAM area files
*/
void JAM_DeleteJAM(char *Base)
{
char *temp;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s%s", Base, EXT_HDRFILE);
unlink(temp);
sprintf(temp, "%s%s", Base, EXT_IDXFILE);
unlink(temp);
sprintf(temp, "%s%s", Base, EXT_TXTFILE);
unlink(temp);
sprintf(temp, "%s%s", Base, EXT_LRDFILE);
unlink(temp);
free(temp);
Syslog('+', "JAM deleted %s", Base);
}
/*
* Search for requested LastRead record.
*/
@@ -528,6 +550,7 @@ int JAM_Open(char *Msgbase)
lseek(fdHdr, 0, SEEK_SET);
write(fdHdr, &jamHdrInfo, sizeof(JAMHDRINFO));
Syslog('+', "JAM created %s", Msgbase);
}
if (jamHdrInfo.Signature[0] == Signature[0] &&
@@ -553,6 +576,9 @@ int JAM_Open(char *Msgbase)
Msg.Id = 0L;
free(File);
if (!RetVal)
WriteError("JAM error open %s", Msgbase);
return RetVal;
}

View File

@@ -1,3 +1,5 @@
/* $Id$ */
#ifndef _JAMMSG_H
#define _JAMMSG_H
@@ -5,6 +7,7 @@
int JAM_AddMsg(void);
void JAM_Close(void);
int JAM_Delete(unsigned long);
void JAM_DeleteJAM(char *);
int JAM_GetLastRead(lastread *);
unsigned long JAM_Highest(void);
int JAM_Lock(unsigned long);

View File

@@ -1,11 +1,10 @@
/*****************************************************************************
*
* File ..................: msg.c
* $Id$
* Purpose ...............: Global message base functions
* Last modification date : 20-Dec-1998
*
*****************************************************************************
* Copyright (C) 1997-1998
* Copyright (C) 1997-2002
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -132,6 +131,16 @@ int Msg_Delete(unsigned long ulMsg)
/*
* Delete message base
*/
void Msg_DeleteMsgBase(char *Base)
{
JAM_DeleteJAM(Base);
}
int Msg_GetLastRead(lastread *LR)
{
return JAM_GetLastRead(LR);

View File

@@ -1,3 +1,5 @@
/* $Id$ */
#ifndef _MSG_H
#define _MSG_H
@@ -117,6 +119,7 @@ long tell(int);
int Msg_AddMsg(void);
void Msg_Close(void);
int Msg_Delete(unsigned long);
void Msg_DeleteMsgBase(char *);
int Msg_GetLastRead(lastread *);
unsigned long Msg_Highest(void);
int Msg_Lock(unsigned long);