From 8f0d05d2107ae03c921570bd623b5faaf13b8fd1 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 18 Feb 2002 16:36:24 +0000 Subject: [PATCH] Updated file area move --- mbsetup/m_farea.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 5372a0cf..28613b1b 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -572,6 +572,7 @@ void EditFilearea(void) fseek(fil, offset, 0); fwrite(&area, areahdr.recsize, 1, fil); memset(&area, 0, sizeof(area)); + /* * Fill in default values */ @@ -588,11 +589,32 @@ void EditFilearea(void) sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), from); sprintf(new, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), too); rename(temp, new); + /* - * Force databse update, don't let the user decide or he will + * Force database update, don't let the user decide or he will * loose all files from the moved areas. */ FileForced = TRUE; + + /* + * Update all other areas in case we just moved the destination + * for MoveArea or Upload area. + */ + fseek(fil, areahdr.hdrsize, SEEK_SET); + count = 0; + while (fread(&area, areahdr.recsize, 1, fil) == 1) { + if (((area.Upload == from) || (area.MoveArea == from)) && area.Available) { + if (area.Upload == from) + area.Upload = too; + if (area.MoveArea == from) + area.MoveArea = too; + count++; + fseek(fil, - areahdr.recsize, SEEK_CUR); + fwrite(&area, areahdr.recsize, 1, fil); + } + } + Syslog('+', "Updated %d fileareas", count); + /* * Update references in tic areas to this filearea. */