diff --git a/ChangeLog b/ChangeLog index ccefdf1f..32ac2a87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -50,6 +50,10 @@ v0.71.2 16-Jan-2005 Added debug logging for exporting netmails from the messagebase so that we later can decide to mark these messages auto deleted. + mbfile: + With adopt, import and move allow to overwrite a file with the + same name if the -f option is used on the commandline. + mbnntp: Does now send the right mime headers recognised by news clients. Fixed compile problem with some compilers. diff --git a/TODO b/TODO index 44f29485..298848f2 100644 --- a/TODO +++ b/TODO @@ -130,19 +130,11 @@ mbcico: N: Implement PLZ turn off m_get command. mbfile: - L: Update <-touch> - L: Possibility to skip file areas from checking and reindexing. - U: mbfile import refuses to import (overwrite) a file that is already - in the file area. See also adopt. - N: It is not possible to import areas that run of cd-roms. Do we still need cd-rom support with current hd prices? - N: Add commandline switch for adopt that allows replacing files that - already exist. - mbnntp: U: fetched mail doesn't get the status Rcvd if it was for the user. diff --git a/mbfido/mbfile.c b/mbfido/mbfile.c index be3d80db..79d20e07 100644 --- a/mbfido/mbfile.c +++ b/mbfido/mbfile.c @@ -63,6 +63,7 @@ int do_move = FALSE; /* Move a file */ int do_del = FALSE; /* Delete/undelete a file */ int do_sort = FALSE; /* Sort a filebase */ int do_rearc = FALSE; /* ReArc a file */ +int do_force = FALSE; /* Force file overwrite */ extern int e_pid; /* Pid of external process */ extern int show_log; /* Show logging */ time_t t_start; /* Start time */ @@ -224,6 +225,8 @@ int main(int argc, char **argv) do_annon = TRUE; } else if (!strncasecmp(argv[i], "-v", 2)) { do_novir = TRUE; + } else if (!strncasecmp(argv[i], "-f", 2)) { + do_force = TRUE; } } diff --git a/mbfido/mbfutil.c b/mbfido/mbfutil.c index 11392fa0..50ab0a9b 100644 --- a/mbfido/mbfutil.c +++ b/mbfido/mbfutil.c @@ -38,6 +38,7 @@ extern int do_quiet; /* Suppress screen output */ +extern int do_force; /* Force file overwrite */ extern int e_pid; /* Pid of external process */ extern time_t t_start; /* Start time */ extern time_t t_end; /* End time */ @@ -129,6 +130,7 @@ void Help(void) printf("\n Options are:\n\n"); mbse_colour(CYAN, BLACK); printf(" -a -announce Suppress announce added files\n"); + printf(" -f -force Force file overwrite\n"); printf(" -q -quiet Quiet mode\n"); printf(" -v -virus Suppress virus scanning, use with care\n"); die(MBERR_COMMANDLINE); @@ -319,14 +321,18 @@ int AddFile(struct FILE_record f_db, int Area, char *DestPath, char *FromPath, c mkdirs(DestPath, 0775); if ((file_exist(DestPath, F_OK) == 0) || (file_exist(LinkPath, F_OK) == 0)) { - WriteError("File %s (%s) already exists in area %d", f_db.Name, f_db.LName, Area); - if (!do_quiet) - printf("\nFile %s (%s) already exists in area %d\n", f_db.Name, f_db.LName, Area); - return FALSE; + if (do_force) { + Syslog('+', "File %s (%s) already exists in area %d, forced overwrite", f_db.Name, f_db.LName, Area); + } else { + WriteError("File %s (%s) already exists in area %d", f_db.Name, f_db.LName, Area); + if (!do_quiet) + printf("\nFile %s (%s) already exists in area %d\n", f_db.Name, f_db.LName, Area); + return FALSE; + } } if ((rc = file_cp(FromPath, DestPath))) { - WriteError("Can't copy file in place"); + WriteError("Can't copy file to %s, %s", DestPath, strerror(rc)); if (!do_quiet) printf("\nCan't copy file to %s, %s\n", DestPath, strerror(rc)); return FALSE;