Fixed existing file check for mbfile adopt and import
This commit is contained in:
parent
f358cb72c8
commit
099601838d
@ -31,14 +31,15 @@ v0.39.1 22-Oct-2003
|
|||||||
mbfile:
|
mbfile:
|
||||||
When the areanumber with the adopt command was not given, the
|
When the areanumber with the adopt command was not given, the
|
||||||
help is displayed instead of trying area 0 that doesn't exist.
|
help is displayed instead of trying area 0 that doesn't exist.
|
||||||
With the file move command if the file already exists in the
|
With the file move, adopt and import command if the file
|
||||||
destination area, the move is refused.
|
already exists in the destination area, the action is refused.
|
||||||
Added mbfile sort <area> command. Files are case insensitive
|
Added mbfile sort <area> command. Files are case insensitive
|
||||||
sorted on the long filename. After sort the indexes are rebuild.
|
sorted on the long filename. After sort the indexes are rebuild.
|
||||||
|
Fixed some logging that should have been debug logging.
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
Added hydra rpos id -1 indicator for compression stop that
|
Added hydra rpos id -1 indicator for compression stop that
|
||||||
Alex and I agreed to use.
|
Alex and I agreed to use. A FSP document will be written.
|
||||||
Compression log fixed and added percentage compression.
|
Compression log fixed and added percentage compression.
|
||||||
Added dynamic optimum sendbuffer size with a maximum of 8192
|
Added dynamic optimum sendbuffer size with a maximum of 8192
|
||||||
bytes with an average size of 2048 bytes.
|
bytes with an average size of 2048 bytes.
|
||||||
|
2
TODO
2
TODO
@ -126,8 +126,6 @@ mbfile:
|
|||||||
|
|
||||||
L: Possibility to skip file areas from checking and reindexing.
|
L: Possibility to skip file areas from checking and reindexing.
|
||||||
|
|
||||||
U: With adopt if a file exists there will be troubles.
|
|
||||||
|
|
||||||
mbmsg:
|
mbmsg:
|
||||||
N: With the post command if a netmail area is used the netmail area
|
N: With the post command if a netmail area is used the netmail area
|
||||||
will cause trouble later, should be blocked to be used on netmail
|
will cause trouble later, should be blocked to be used on netmail
|
||||||
|
@ -58,7 +58,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
int i, j, k, lines = 0, File_id_cnt = 0, rc;
|
int i, j, k, lines = 0, File_id_cnt = 0, rc;
|
||||||
struct FILERecord fdb;
|
struct FILERecord fdb;
|
||||||
|
|
||||||
Syslog('-', "Adopt(%d, %s, %s)", Area, MBSE_SS(File), MBSE_SS(Description));
|
Syslog('f', "Adopt(%d, %s, %s)", Area, MBSE_SS(File), MBSE_SS(Description));
|
||||||
|
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
@ -91,7 +91,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
if ((rc = file_cp(temp, temp2))) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
printf("\nCan't copy file to %s, %s\n", temp2, strerror(rc));
|
||||||
die(MBERR_INIT_ERROR);
|
die(MBERR_INIT_ERROR);
|
||||||
} else {
|
} else {
|
||||||
if (do_novir == FALSE) {
|
if (do_novir == FALSE) {
|
||||||
@ -108,7 +108,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
WriteError("Virus found");
|
WriteError("Virus found");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Virus found\n");
|
printf("\nVirus found\n");
|
||||||
die(MBERR_VIRUS_FOUND);
|
die(MBERR_VIRUS_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
WriteError("Virus found");
|
WriteError("Virus found");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Virus found\n");
|
printf("\nVirus found\n");
|
||||||
die(MBERR_VIRUS_FOUND);
|
die(MBERR_VIRUS_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (File_Id) {
|
if (File_Id) {
|
||||||
Syslog('-', "FILE_ID.DIZ found");
|
Syslog('f', "FILE_ID.DIZ found");
|
||||||
if ((fp = fopen(temp2, "r"))) {
|
if ((fp = fopen(temp2, "r"))) {
|
||||||
/*
|
/*
|
||||||
* Read no more then 25 lines
|
* Read no more then 25 lines
|
||||||
@ -219,7 +219,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
if (Description == NULL) {
|
if (Description == NULL) {
|
||||||
WriteError("No FILE_ID.DIZ and no description on the commandline");
|
WriteError("No FILE_ID.DIZ and no description on the commandline");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("No FILE_ID.DIZ and no description on the commandline\n");
|
printf("\nNo FILE_ID.DIZ and no description on the commandline\n");
|
||||||
DeleteVirusWork();
|
DeleteVirusWork();
|
||||||
die(MBERR_COMMANDLINE);
|
die(MBERR_COMMANDLINE);
|
||||||
} else {
|
} else {
|
||||||
@ -303,7 +303,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
} else {
|
} else {
|
||||||
WriteError("Area %d is not available", Area);
|
WriteError("Area %d is not available", Area);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Area %d is not available\n", Area);
|
printf("\nArea %d is not available\n", Area);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose: File Database Maintenance - Import files with files.bbs
|
* Purpose: File Database Maintenance - Import files with files.bbs
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -59,7 +59,7 @@ void ImportFiles(int Area)
|
|||||||
struct stat statfile;
|
struct stat statfile;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
Syslog('-', "Import(%d)", Area);
|
Syslog('f', "Import(%d)", Area);
|
||||||
|
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
|
@ -153,8 +153,6 @@ void Move(int From, int To, char *File)
|
|||||||
tothumb = xstrcat(tothumb, fdb.Name);
|
tothumb = xstrcat(tothumb, fdb.Name);
|
||||||
|
|
||||||
if (file_exist(topath, F_OK) == 0) {
|
if (file_exist(topath, F_OK) == 0) {
|
||||||
Syslog('-', "%s", topath);
|
|
||||||
Syslog('-', "%d", file_exist(topath, F_OK));
|
|
||||||
WriteError("File %s already exists in area %d", File, To);
|
WriteError("File %s already exists in area %d", File, To);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("File %s already exists in area %d\n", File, To);
|
printf("File %s already exists in area %d\n", File, To);
|
||||||
|
@ -251,7 +251,7 @@ int UnpackFile(char *File)
|
|||||||
if (mkdir(temp, 0777)) {
|
if (mkdir(temp, 0777)) {
|
||||||
WriteError("$Can't create %s", temp);
|
WriteError("$Can't create %s", temp);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't create %s\n", temp);
|
printf("\nCan't create %s\n", temp);
|
||||||
die(MBERR_GENERAL);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ int UnpackFile(char *File)
|
|||||||
if (!getarchiver(unarc)) {
|
if (!getarchiver(unarc)) {
|
||||||
WriteError("No archiver available for %s", File);
|
WriteError("No archiver available for %s", File);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("No archiver available for %s\n", File);
|
printf("\nNo archiver available for %s\n", File);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ int UnpackFile(char *File)
|
|||||||
if ((cmd == NULL) || (cmd == "")) {
|
if ((cmd == NULL) || (cmd == "")) {
|
||||||
WriteError("No unarc command available");
|
WriteError("No unarc command available");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("No unarc command available\n");
|
printf("\nNo unarc command available\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,10 +321,18 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath, cha
|
|||||||
* 8.3 filename to the long filename.
|
* 8.3 filename to the long filename.
|
||||||
*/
|
*/
|
||||||
mkdirs(DestPath, 0775);
|
mkdirs(DestPath, 0775);
|
||||||
|
|
||||||
|
if (file_exist(DestPath, F_OK) == 0) {
|
||||||
|
WriteError("File %s already exists in area %d", fdb.Name, Area);
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("\nFile %s already exists in area %d\n", fdb.Name, Area);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rc = file_cp(FromPath, DestPath))) {
|
if ((rc = file_cp(FromPath, DestPath))) {
|
||||||
WriteError("Can't copy file in place");
|
WriteError("Can't copy file in place");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't copy file to %s, %s\n", DestPath, strerror(rc));
|
printf("\nCan't copy file to %s, %s\n", DestPath, strerror(rc));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
chmod(DestPath, 0644);
|
chmod(DestPath, 0644);
|
||||||
@ -332,7 +340,7 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath, cha
|
|||||||
if ((rc = symlink(DestPath, LinkPath))) {
|
if ((rc = symlink(DestPath, LinkPath))) {
|
||||||
WriteError("Can't create symbolic link %s", LinkPath);
|
WriteError("Can't create symbolic link %s", LinkPath);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't create symbolic link %s, %s\n", LinkPath, strerror(rc));
|
printf("\nCan't create symbolic link %s, %s\n", LinkPath, strerror(rc));
|
||||||
unlink(DestPath);
|
unlink(DestPath);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -493,7 +501,7 @@ int LoadAreaRec(int Area)
|
|||||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", sAreas);
|
WriteError("$Can't open %s", sAreas);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't open %s\n", sAreas);
|
printf("\nCan't open %s\n", sAreas);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +509,7 @@ int LoadAreaRec(int Area)
|
|||||||
if (fseek(pAreas, ((Area - 1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET)) {
|
if (fseek(pAreas, ((Area - 1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET)) {
|
||||||
WriteError("$Can't seek record %d in %s", Area, sAreas);
|
WriteError("$Can't seek record %d in %s", Area, sAreas);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't seek record %d in %s\n", Area, sAreas);
|
printf("\nCan't seek record %d in %s\n", Area, sAreas);
|
||||||
fclose(pAreas);
|
fclose(pAreas);
|
||||||
free(sAreas);
|
free(sAreas);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -510,7 +518,7 @@ int LoadAreaRec(int Area)
|
|||||||
if (fread(&area, areahdr.recsize, 1, pAreas) != 1) {
|
if (fread(&area, areahdr.recsize, 1, pAreas) != 1) {
|
||||||
WriteError("$Can't read record %d in %s", Area, sAreas);
|
WriteError("$Can't read record %d in %s", Area, sAreas);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("Can't read record %d in %s\n", Area, sAreas);
|
printf("\nCan't read record %d in %s\n", Area, sAreas);
|
||||||
fclose(pAreas);
|
fclose(pAreas);
|
||||||
free(sAreas);
|
free(sAreas);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -330,7 +330,7 @@ if [ "$DISTNAME" = "Gentoo" ]; then
|
|||||||
DISTINIT="/etc/init.d/mbsebbs"
|
DISTINIT="/etc/init.d/mbsebbs"
|
||||||
cp init.Gentoo $DISTINIT
|
cp init.Gentoo $DISTINIT
|
||||||
chmod 755 $DISTINIT
|
chmod 755 $DISTINIT
|
||||||
update-rc mbsebbs defaults
|
rc-update add mbsebbs default
|
||||||
echo "Gentoo install ready."
|
echo "Gentoo install ready."
|
||||||
log "+" "Gentoo init script installed"
|
log "+" "Gentoo init script installed"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user