Fixed mbfile adopt command
This commit is contained in:
parent
a9b52fc476
commit
db587ddcd8
@ -18,6 +18,10 @@ v0.71.1 28-Nov-2004
|
|||||||
mbnewuser:
|
mbnewuser:
|
||||||
During hangup we set sighup to ignore.
|
During hangup we set sighup to ignore.
|
||||||
|
|
||||||
|
mbfile:
|
||||||
|
The adopt command now first checks if the filename is 8.3 or a
|
||||||
|
long filename and the correct format for import is then set.
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
Removed bbs list items from the English menus and txtfiles and
|
Removed bbs list items from the English menus and txtfiles and
|
||||||
the Spanish menus and txtfiles.
|
the Spanish menus and txtfiles.
|
||||||
|
2
TODO
2
TODO
@ -146,8 +146,6 @@ mbfile:
|
|||||||
N: It is not possible to import areas that run of cd-roms. Do we still
|
N: It is not possible to import areas that run of cd-roms. Do we still
|
||||||
need cd-rom support with current hd prices?
|
need cd-rom support with current hd prices?
|
||||||
|
|
||||||
N: The adopt command switches the LFN and 8.3 name.
|
|
||||||
|
|
||||||
N: The import command doesn't work with long filenames.
|
N: The import command doesn't work with long filenames.
|
||||||
|
|
||||||
N: Several import commands shoudlcheck ownership of the files before
|
N: Several import commands shoudlcheck ownership of the files before
|
||||||
|
@ -257,16 +257,34 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
DeleteVirusWork();
|
DeleteVirusWork();
|
||||||
/*
|
/*
|
||||||
* Convert to 8.3 DOS filename
|
* Work out the kind of filename, is it a long filename
|
||||||
|
* or a 8.3 DOS filename. The file on disk must become
|
||||||
|
* 8.3 for import.
|
||||||
*/
|
*/
|
||||||
strcpy(temp2, File);
|
if (is_real_8_3(File)) {
|
||||||
name_mangle(temp2);
|
Syslog('f', "Adopt, file is 8.3");
|
||||||
strcpy(f_db.Name, temp2);
|
strcpy(f_db.Name, File);
|
||||||
strcpy(f_db.LName, File);
|
strcpy(f_db.LName, File);
|
||||||
f_db.Size = file_size(File);
|
for (i = 0; i < strlen(File); i++)
|
||||||
f_db.Crc32 = file_crc(File, TRUE);
|
if (isupper(f_db.LName[i]))
|
||||||
f_db.FileDate = file_time(File);
|
f_db.LName[i] = tolower(f_db.LName[i]);
|
||||||
sprintf(temp2, "%s/%s", area.Path, File);
|
} else {
|
||||||
|
Syslog('f', "Adopt, file is LFN");
|
||||||
|
strcpy(temp2, File);
|
||||||
|
name_mangle(temp2);
|
||||||
|
if (rename(File, temp2)) {
|
||||||
|
Syslog('+', "Can't rename %s to %s", File, temp2);
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("\nCan't rename %s to %s\n", File, temp2);
|
||||||
|
die(MBERR_GENERAL);
|
||||||
|
}
|
||||||
|
strcpy(f_db.Name, temp2);
|
||||||
|
strcpy(f_db.LName, File);
|
||||||
|
}
|
||||||
|
f_db.Size = file_size(f_db.Name);
|
||||||
|
f_db.Crc32 = file_crc(f_db.Name, TRUE);
|
||||||
|
f_db.FileDate = file_time(f_db.Name);
|
||||||
|
sprintf(temp2, "%s/%s", area.Path, f_db.Name);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("Adding \b\b\b\b\b\b\b\b\b\b");
|
printf("Adding \b\b\b\b\b\b\b\b\b\b");
|
||||||
@ -275,8 +293,8 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
|
|
||||||
if (strcmp(f_db.Name, f_db.LName)) {
|
if (strcmp(f_db.Name, f_db.LName)) {
|
||||||
lname = calloc(PATH_MAX, sizeof(char));
|
lname = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(lname, "%s/%s", area.Path, f_db.Name);
|
sprintf(lname, "%s/%s", area.Path, f_db.LName);
|
||||||
if (AddFile(f_db, Area, temp2, File, lname) == FALSE) {
|
if (AddFile(f_db, Area, temp2, f_db.Name, lname) == FALSE) {
|
||||||
die(MBERR_GENERAL);
|
die(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
free(lname);
|
free(lname);
|
||||||
|
@ -307,6 +307,11 @@ int AddFile(struct FILE_record f_db, int Area, char *DestPath, char *FromPath, c
|
|||||||
int rc;
|
int rc;
|
||||||
struct _fdbarea *fdb_area = NULL;
|
struct _fdbarea *fdb_area = NULL;
|
||||||
|
|
||||||
|
Syslog('f', "AddFile Area : %d", Area);
|
||||||
|
Syslog('f', "AddFile DestPath: %s", MBSE_SS(DestPath));
|
||||||
|
Syslog('f', "AddFile FromPath: %s", MBSE_SS(FromPath));
|
||||||
|
Syslog('f', "AddFile LinkPath: %s", MBSE_SS(LinkPath));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy file to the final destination and make a hard link with the
|
* Copy file to the final destination and make a hard link with the
|
||||||
* 8.3 filename to the long filename.
|
* 8.3 filename to the long filename.
|
||||||
@ -442,3 +447,16 @@ int LoadAreaRec(int Area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int is_real_8_3(char *File)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (! is_8_3(File))
|
||||||
|
return FALSE;
|
||||||
|
for (i = 0; i < strlen(File); i++)
|
||||||
|
if (isalpha(File[i]) && islower(File[i]))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -12,5 +12,6 @@ int UnpackFile(char *File); /* Unpack archive */
|
|||||||
int AddFile(struct FILE_record, int, char *, char *, char *);
|
int AddFile(struct FILE_record, int, char *, char *, char *);
|
||||||
int CheckFDB(int, char *); /* Check FDB of area */
|
int CheckFDB(int, char *); /* Check FDB of area */
|
||||||
int LoadAreaRec(int); /* Load Area record */
|
int LoadAreaRec(int); /* Load Area record */
|
||||||
|
int is_real_8_3(char *); /* Check for 8.3 uppercase */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user