Added better support for short and long filenames

This commit is contained in:
Michiel Broek 2002-11-23 16:48:54 +00:00
parent 85bd9bcd1e
commit ffe9331fb0
21 changed files with 528 additions and 417 deletions

View File

@ -5,21 +5,47 @@ $Id$
v0.35.06
update:
Run "mbfile check". This will create a error in the logfile
for each file! It will update the filenames on disk to have
both short and long filenames. Just ignore the errors!
general:
This may become release 0.36.00 (again).
Added better support for 8.3 and long filenames by creating
hard links in the download directories.
mbsebbs:
Several user input functions don't allow comma's anymore.
Uploaded files will now also have a 8.3 hard link to the long
filename.
Filesearch on filename now uses regexp to find the files.
mbfido:
TIC file forwarding now uses a list of qualified systems to
forward to, and with this information builds more reliable
seen-by lines.
Imported tic files with a new banner file in the archive got
the wrong filetime in the files database. The mbfile check
command would detect and correct this.
TIC files added to the bbs will now also have a 8.3 hard link.
mbcico:
With filetransfer errors, the attempts counter was not
increased.
mbfile:
Finished complete support for 8.3 and long filenames.
The check function now creates hard links in the download
areas with the 8.3 filename to the long filename so that the
files seem to exist under both names.
The delete and move functions can now use 8.3 or long
filenames as argument.
mbsetup:
In filedatabase editor, if a file is deleted the name is
displayed in light blue.
v0.35.05 19-Oct-2002 - 13-Nov-2002.

View File

@ -267,8 +267,8 @@
266 change.c |Protocol now set to:
267 file.c |Enter keyword to use for Search:
268 file.c |File Search by Keyword
269 file.c |Accepts wildcards such as : *.zip, *.gz, .tar*
270 file.c | : *.zip is the same as .zip
269 file.c |Accepts wildcards such as : *.zip, *.gz, *.*
270 | : *.zip is the same as .zip
271 file.c |Enter filename to search for :
272 file.c |File Search by Filename
273 file.c YN|Search for new since your last call [Y/n]:

View File

@ -267,7 +267,7 @@ JN|Node onbekend, toch doorgaan [j/N]:
|Het protocol is nu:
|Geef sleutelwoord om op te zoeken :
|Bestanden zoeken op sleutelwoord
|Accepteerd jokers zoals : *.zip, *.gz, .tar*
|Accepteerd jokers zoals : *.zip, *.gz, *.*
| : *.zip is hetzelfde als .zip
|Geef bestandsnaam om naar te zoeken :
|Bestanden zoeken op naam

View File

@ -267,7 +267,7 @@ YN|Node not known, continue anyway [y/N]:
|Protocol now set to:
|Enter keyword to use for Search:
|File Search by Keyword
|Accepts wildcards such as : *.zip, *.gz, .tar*
|Accepts wildcards such as : *.zip, *.gz, *.*
| : *.zip is the same as .zip
|Enter filename to search for :
|File Search by Filename

View File

@ -267,7 +267,7 @@ SN|Nodo desco
|Protocolo predeterminado:
|Palabra a buscar:
|Buscar ficheiro por unha palabra
|Aceptanse comodins coma : *.zip, *.gz, .tar*
|Aceptanse comodins coma : *.zip, *.gz, *.*
| : *.zip es lo mismo que .zip
|Nome do ficheiro a buscar:
|Buscar ficheiro por nome

View File

@ -267,7 +267,7 @@ JN|Adresse unbekannt, dennoch fortfahren [j/N]:
|Standardprotokoll ist jetzt:
|Bitte den Suchbegriff eingeben:
|Dateisuche nach Schluesselwort
|Akzeptiert Platzhalter wie: *.zip, *.gz, .tar*
|Akzeptiert Platzhalter wie: *.zip, *.gz, *.*
| *.zip entspricht .zip
|Geben Sie den zu suchenden Dateinamen an:
|Dateisuche nach Dateinamen

View File

@ -267,7 +267,7 @@ SN|Nodo sconosciuto, continua lo stesso [s/N]:
|Protocollo impostato su:
|Inserisci la parola da cercare:
|Ricerca file per parola chiave
|Accetto caratteri jolly come : *.zip, *.gz, .tar*
|Accetto caratteri jolly come : *.zip, *.gz, *.*
| : *.zip e' equivalente a .zip
|Scegli il filename da cercare:
|Ricerca per nome del file

View File

@ -267,7 +267,7 @@ SN|Nodo desconocido.
|Protocolo predeterminado:
|Palabra a buscar:
|Buscar fichero por una palabra
|Se aceptan comodines como : *.zip, *.gz, .tar*
|Se aceptan comodines como : *.zip, *.gz, *.*
| : *.zip es lo mismo que .zip
|Nombre de fichero a buscar:
|Buscar fichero por nombre

View File

@ -57,7 +57,7 @@ int Add_BBS()
struct FILERecord frec;
int rc, i, Insert, Done = FALSE, Found = FALSE;
char fdbname[PATH_MAX], fdbtemp[PATH_MAX];
char temp1[PATH_MAX], temp2[PATH_MAX], *fname;
char temp1[PATH_MAX], temp2[PATH_MAX], *fname, *lname;
FILE *fdb, *fdt;
int Keep = 0, DidDelete = FALSE;
fd_list *fdl = NULL;
@ -142,6 +142,12 @@ int Add_BBS()
return FALSE;
}
chmod(temp2, 0644);
lname = calloc(PATH_MAX, sizeof(char));
sprintf(lname, "%s/%s", TIC.BBSpath, frec.Name);
if (link(temp2, lname)) {
WriteError("$Create link %s to %s failed", lname, temp2);
}
free(lname);
sprintf(fdbtemp, "%s/fdb/fdb%ld.temp", getenv("MBSE_ROOT"), tic.FileArea);
@ -365,6 +371,9 @@ int Add_BBS()
sprintf(temp2, "%s/%s", area.Path, file.LName);
if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2);
sprintf(temp2, "%s/%s", area.Path, file.Name);
if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2);
}
fclose(fdb);
fclose(fdt);

View File

@ -52,7 +52,7 @@ extern int do_novir; /* Suppress virus check */
void AdoptFile(int Area, char *File, char *Description)
{
FILE *fp;
char *temp, *temp2, *tmpdir, *unarc, *pwd;
char *temp, *temp2, *tmpdir, *unarc, *pwd, *lname;
char Desc[256], TDesc[256];
int IsArchive = FALSE, MustRearc = FALSE, UnPacked = FALSE;
int IsVirus = FALSE, File_Id = FALSE;
@ -279,9 +279,18 @@ void AdoptFile(int Area, char *File, char *Description)
fflush(stdout);
}
if (AddFile(fdb, Area, temp2, File) == FALSE) {
if (strcmp(fdb.Name, fdb.LName)) {
lname = calloc(PATH_MAX, sizeof(char));
sprintf(lname, "%s/%s", area.Path, fdb.Name);
if (AddFile(fdb, Area, temp2, File, lname) == FALSE) {
die(MBERR_GENERAL);
}
free(lname);
} else {
if (AddFile(fdb, Area, temp2, File, NULL) == FALSE) {
die(MBERR_GENERAL);
}
}
Syslog('+', "File %s added to area %d", File, Area);
if (MustRearc) {

View File

@ -67,7 +67,7 @@ void Check(void)
{
FILE *pAreas, *pFile;
int i, iAreas, iAreasNew = 0, Fix, inArea, iTotal = 0, iErrors = 0;
char *sAreas, *fAreas, *newdir, *temp;
char *sAreas, *fAreas, *newdir, *temp, *lname;
DIR *dp;
struct dirent *de;
int Found, Update;
@ -80,6 +80,7 @@ void Check(void)
fAreas = calloc(PATH_MAX, sizeof(char));
newdir = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
lname = calloc(PATH_MAX, sizeof(char));
if (!do_quiet) {
colour(3, 0);
@ -221,12 +222,25 @@ void Check(void)
strcpy(temp, file.LName);
name_mangle(temp);
sprintf(lname, "%s/%s", area.Path, temp);
if (strcmp(file.Name, temp)) {
Syslog('!', "Converted %s to %s", file.Name, temp);
strncpy(file.Name, temp, 12);
iErrors++;
Update = TRUE;
}
/*
* Check hard link to the short/mangled filename.
*/
if (strcmp(file.Name, file.LName)) {
if (file_exist(lname, F_OK)) {
if (link(newdir, lname)) {
WriteError("$Can't create link %s to %s", lname, newdir);
} else {
Syslog('!', "Created hard link area %d LFN %s to 8.3 %s", i, file.LName, file.Name);
}
}
}
if (file_time(newdir) != file.FileDate) {
Syslog('!', "Date mismatch area %d file %s", i, file.LName);
file.FileDate = file_time(newdir);
@ -267,7 +281,7 @@ void Check(void)
Found = FALSE;
rewind(pFile);
while (fread(&file, sizeof(file), 1, pFile) == 1) {
if (strcmp(file.LName, de->d_name) == 0) {
if ((strcmp(file.LName, de->d_name) == 0) || (strcmp(file.Name, de->d_name) == 0)) {
if (!Found) {
Found = TRUE;
} else {
@ -331,6 +345,7 @@ void Check(void)
fflush(stdout);
}
free(lname);
free(temp);
free(newdir);
free(sAreas);

View File

@ -94,7 +94,7 @@ void Delete(int UnDel, int Area, char *File)
colour(CYAN, BLACK);
while (fread(&fdb, sizeof(fdb), 1, fp) == 1) {
if (! strcmp(fdb.LName, File)) {
if ((! strcmp(fdb.LName, File) || (! strcmp(fdb.Name, File)))) {
if (UnDel && fdb.Deleted) {
fdb.Deleted = FALSE;
Syslog('+', "Marked file %s in area %d for undeletion", File, Area);

View File

@ -51,7 +51,7 @@ extern int do_novir; /* Suppress virus scanning */
void ImportFiles(int Area)
{
char *pwd, *temp, *temp2, *tmpdir, *String, *token, *dest, *unarc;
char *pwd, *temp, *temp2, *tmpdir, *String, *token, *dest, *unarc, *lname;
FILE *fbbs;
int Append = FALSE, Files = 0, rc, i, j = 0, k = 0, x, Doit;
int Imported = 0, Errors = 0, Present = FALSE;
@ -73,6 +73,7 @@ void ImportFiles(int Area)
tmpdir = calloc(PATH_MAX, sizeof(char));
String = calloc(4096, sizeof(char));
dest = calloc(PATH_MAX, sizeof(char));
lname = calloc(PATH_MAX, sizeof(char));
getcwd(pwd, PATH_MAX);
if (CheckFDB(Area, area.Path))
@ -151,10 +152,19 @@ void ImportFiles(int Area)
printf("Adding \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (AddFile(fdb, Area, dest, temp)) {
if (strcmp(fdb.Name, fdb.LName)) {
if (AddFile(fdb, Area, dest, temp, lname)) {
Imported++;
} else
} else {
Errors++;
}
} else {
if (AddFile(fdb, Area, dest, temp, NULL)) {
Imported++;
} else {
Errors++;
}
}
} else {
Errors++;
}
@ -252,6 +262,7 @@ void ImportFiles(int Area)
}
sprintf(dest, "%s/%s", area.Path, fdb.LName);
sprintf(lname, "%s/%s", area.Path, fdb.Name);
Append = TRUE;
fdb.Size = statfile.st_size;
fdb.FileDate = statfile.st_mtime;
@ -354,15 +365,23 @@ void ImportFiles(int Area)
printf("Adding \b\b\b\b\b\b\b\b\b\b");
fflush(stdout);
}
if (AddFile(fdb, Area, dest, temp))
if (strcmp(fdb.Name, fdb.LName)) {
if (AddFile(fdb, Area, dest, temp, lname))
Imported++;
else
Errors++;
} else {
if (AddFile(fdb, Area, dest, temp, NULL))
Imported++;
else
Errors++;
}
} else {
Errors++;
}
}
free(lname);
free(dest);
free(String);
free(pwd);

View File

@ -52,10 +52,10 @@ extern int do_quiet; /* Suppress screen output */
*/
void Move(int From, int To, char *File)
{
char *frompath, *topath, *temp1, *temp2;
char *frompath, *topath, *temp1, *temp2, *fromlink, *tolink;
struct FILERecord fdb;
FILE *fp1, *fp2;
int rc = FALSE;
int rc = FALSE, Found = FALSE;
IsDoing("Move file");
colour(LIGHTRED, BLACK);
@ -88,9 +88,35 @@ void Move(int From, int To, char *File)
}
if (CheckFDB(From, area.Path))
die(MBERR_GENERAL);
/*
* Find the file in the "from" area, check LFN and 8.3 names.
*/
temp1 = calloc(PATH_MAX, sizeof(char));
sprintf(temp1, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), From);
if ((fp1 = fopen(temp1, "r")) == NULL)
die(MBERR_GENERAL);
while (fread(&fdb, sizeof(fdb), 1, fp1) == 1) {
if ((strcmp(fdb.LName, File) == 0) || strcmp(fdb.Name, File) == 0) {
Found = TRUE;
break;
}
}
fclose(fp1);
if (!Found) {
WriteError("File %s not found in area %d", File, From);
if (!do_quiet)
printf("File %s not found in area %d\n", File, From);
free(temp1);
die(MBERR_GENERAL);
}
frompath = xstrcpy(area.Path);
frompath = xstrcat(frompath, (char *)"/");
frompath = xstrcat(frompath, File);
frompath = xstrcat(frompath, fdb.LName);
fromlink = xstrcpy(area.Path);
fromlink = xstrcat(fromlink, (char *)"/");
fromlink = xstrcat(fromlink, fdb.Name);
/*
* Check Destination area
@ -113,13 +139,15 @@ void Move(int From, int To, char *File)
}
if (CheckFDB(To, area.Path))
die(MBERR_GENERAL);
topath = xstrcpy(area.Path);
topath = xstrcat(topath, (char *)"/");
topath = xstrcat(topath, File);
topath = xstrcat(topath, fdb.LName);
tolink = xstrcpy(area.Path);
tolink = xstrcat(tolink, (char *)"/");
tolink = xstrcat(tolink, fdb.Name);
temp1 = calloc(PATH_MAX, sizeof(char));
temp2 = calloc(PATH_MAX, sizeof(char));
sprintf(temp1, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), From);
sprintf(temp2, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), From);
if ((fp1 = fopen(temp1, "r")) == NULL)
@ -133,11 +161,19 @@ void Move(int From, int To, char *File)
* file.
*/
while (fread(&fdb, sizeof(fdb), 1, fp1) == 1) {
if (strcmp(fdb.LName, File))
if (strcmp(fdb.LName, File) && strcmp(fdb.Name, File))
fwrite(&fdb, sizeof(fdb), 1, fp2);
else {
rc = AddFile(fdb, To, topath, frompath);
if (strcmp(fdb.Name, fdb.LName))
rc = AddFile(fdb, To, topath, frompath, tolink);
else
rc = AddFile(fdb, To, topath, frompath, NULL);
if (rc) {
/*
* Remove old 8.3 name
*/
if (strcmp(fdb.Name, fdb.LName))
unlink(fromlink);
/*
* Try to move thumbnail if it exists
*/
@ -189,7 +225,9 @@ void Move(int From, int To, char *File)
free(temp1);
free(temp2);
free(frompath);
free(fromlink);
free(topath);
free(tolink);
}

View File

@ -54,8 +54,7 @@ extern int do_index; /* Reindex filebases */
void PackFileBase(void)
{
FILE *fp, *pAreas, *pFile;
int i, iAreas, iAreasNew = 0, rc;
int iTotal = 0, iRemoved = 0;
int i, iAreas, iAreasNew = 0, rc, iTotal = 0, iRemoved = 0;
char *sAreas, *fAreas, *fTmp, fn[PATH_MAX];
sAreas = calloc(PATH_MAX, sizeof(char));
@ -125,6 +124,10 @@ void PackFileBase(void)
Syslog('+', "Removed file \"%s\" from area %d", file.LName, i);
sprintf(fn, "%s/%s", area.Path, file.LName);
rc = unlink(fn);
if (rc)
Syslog('+', "Unlink %s failed, result %d", fn, rc);
sprintf(fn, "%s/%s", area.Path, file.Name);
rc = unlink(fn);
if (rc)
Syslog('+', "Unlink %s failed, result %d", fn, rc);
/*

View File

@ -309,12 +309,16 @@ int UnpackFile(char *File)
* directory. The fdb record already has all needed
* information.
*/
int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath)
int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath, char *LinkPath)
{
char *temp1, *temp2;
FILE *fp1, *fp2;
int i, rc, Insert, Done = FALSE, Found = FALSE;
/*
* Copy file to the final destination and make a hard link with the
* 8.3 filename to the long filename.
*/
mkdirs(DestPath, 0775);
if ((rc = file_cp(FromPath, DestPath))) {
WriteError("Can't copy file in place");
@ -323,6 +327,15 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath)
return FALSE;
}
chmod(DestPath, 0644);
if (LinkPath) {
if ((rc = link(DestPath, LinkPath))) {
WriteError("Can't create link %s", LinkPath);
if (!do_quiet)
printf("Can't create link %s, %s\n", LinkPath, strerror(rc));
unlink(DestPath);
return FALSE;
}
}
temp1 = calloc(PATH_MAX, sizeof(char));
temp2 = calloc(PATH_MAX, sizeof(char));

View File

@ -9,7 +9,7 @@ void Help(void); /* Show help screen */
void Marker(void); /* Eyecatcher */
void DeleteVirusWork(void); /* Delete unarc directory */
int UnpackFile(char *File); /* Unpack archive */
int AddFile(struct FILERecord, int, char *, char *);
int AddFile(struct FILERecord, int, char *, char *, char *);
int CheckFDB(int, char *); /* Check FDB of area */
int LoadAreaRec(int); /* Load Area record */

View File

@ -695,16 +695,24 @@ int ProcessTic(fa_list *sbl)
* If the file is converted, we set the date of the original
* received file as the file creation date.
*/
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewName);
if ((MustRearc || DidBanner) && CFG.ct_KeepDate) {
if ((tic.Touch) && (tic.FileArea)) {
ut.actime = mktime(localtime(&TIC.FileDate));
ut.modtime = mktime(localtime(&TIC.FileDate));
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewName);
utime(Temp, &ut);
Syslog('-', "Restamp filedate %s to %s", Temp, rfcdate(ut.modtime));
}
}
/*
* Now make sure the file timestamp is updated. The file may be restamped,
* altered by banners etc.
*/
TIC.FileDate = file_time(Temp);
/*
* If not passthru, import in the BBS.
*/
if (tic.FileArea) {
Syslog('+', "Import: %s Area: %s", TIC.NewName, TIC.TicIn.Area);
@ -795,21 +803,6 @@ int ProcessTic(fa_list *sbl)
tic_out++;
}
}
/*
* Now start forwarding files
*/
// First = TRUE;
// while (GetTicSystem(&Link, First)) {
// First = FALSE;
// if ((Link.aka.zone) && (Link.sendto) && (!Link.pause)) {
// if (!((TIC.Aka.zone == Link.aka.zone) && (TIC.Aka.net == Link.aka.net) &&
// (TIC.Aka.node == Link.aka.node) && (TIC.Aka.point == Link.aka.point))) {
// tic_out++;
// ForwardFile(Link.aka, sbl);
// }
// }
// }
}
Magic_ExecCommand();
@ -818,8 +811,8 @@ int ProcessTic(fa_list *sbl)
Magic_AdoptFile();
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName);
unlink(Temp);
free(Temp);
tidy_qualify(&qal);
return 0;

View File

@ -713,27 +713,21 @@ int KeywordScan()
int FilenameScan()
{
FILE *pAreas, *pFile;
int z, y, Found, Count = 0;
int Found, Count = 0;
char *p, *q, mask[256];
char *Name;
char *tmpname, *tmpname2;
char temp[81];
_Tag T;
unsigned long OldArea;
Name = calloc(81, sizeof(char));
tmpname = calloc(81, sizeof(char));
tmpname2 = calloc(81, sizeof(char));
OldArea = iAreaNumber;
iLineCount = 2; /* Reset Line Counter to Zero */
arecno = 1; /* Reset Area Number to One */
Enter(2);
/* Accepts wildcards such as : *.zip, *.gz, .tar */
/* Accepts wildcards such as : *.zip, *.gz, *.* */
pout(15, 0, (char *) Language(269));
Enter(1);
/* : *.zip is the same as .zip */
pout(15, 0, (char *) Language(270));
Enter(2);
/* Enter filename to search for : */
@ -743,30 +737,32 @@ int FilenameScan()
GetstrC(Name, 80);
if ((strcmp(Name, "")) == 0) {
free(tmpname);
free(Name);
return 0;
}
/*
* If there is a file extension, strip it off, it are mostly
* archiver extensions, and who knows what we're using as
* archiver.
* Make a regexp string for the users search mask.
*/
if (strchr(Name, '.') != NULL)
strcpy(tmpname, strtok(Name, "."));
else
strcpy(tmpname, tl(Name));
strcpy(Name, "");
y = strlen(tmpname);
for(z = 0; z < y; z++) {
if(tmpname[z] != '*') {
sprintf(temp, "%c", tmpname[z]);
strcat(Name, temp);
p = tl(Name);
q = mask;
*q++ = '^';
while ((*p) && (q < (mask + sizeof(mask) - 4))) {
switch (*p) {
case '\\': *q++ = '\\'; *q++ = '\\'; break;
case '?': *q++ = ','; break;
case '.': *q++ = '\\'; *q++ = '.'; break;
case '+': *q++ = '\\'; *q++ = '+'; break;
case '*': *q++ = '.'; *q++ = '*'; break;
default: *q++ = toupper(*p); break;
}
p++;
}
tl(Name);
Syslog('+', "FilenameScan(): \"%s\"", Name);
*q++ = '$';
*q++ = '\0';
Syslog('+', "FilenameScan(): \"%s\" -> \"%s\"", Name, mask);
free(Name);
re_comp(mask);
clear();
/* File Search by Filename */
@ -788,17 +784,10 @@ int FilenameScan()
while (fread(&file, sizeof(file), 1, pFile) == 1) {
strcpy(tmpname, file.Name);
strcpy(tmpname2, file.LName);
tl(tmpname);
tl(tmpname2);
if (((strstr(tmpname, Name)) != NULL) || ((strstr(tmpname2, Name)) != NULL)) {
if (re_exec(file.Name) || re_exec(file.LName)) {
if (!Found) {
Enter(2);
if (iLC(2) == 1) {
free(Name);
free(tmpname);
free(tmpname2);
SetFileArea(OldArea);
return 1;
}
@ -815,9 +804,6 @@ int FilenameScan()
SetTag(T);
Count++;
if (ShowOneFile() == 1) {
free(Name);
free(tmpname);
free(tmpname2);
SetFileArea(OldArea);
return 1;
}
@ -829,9 +815,6 @@ int FilenameScan()
if (Found) {
Enter(2);
if (iLC(2) == 1) {
free(Name);
free(tmpname);
free(tmpname2);
SetFileArea(OldArea);
return 1;
}
@ -845,9 +828,6 @@ int FilenameScan()
Syslog('+', "Found %d files", Count);
fclose(pAreas);
free(Name);
free(tmpname);
free(tmpname2);
printf("\n");
if (Count)
Mark();

View File

@ -847,13 +847,12 @@ int Addfile(char *File, int AreaNum, int fileid)
{
FILE *id, *pFileDB, *pPrivate;
int err = 1, iDesc = 1, iPrivate = FALSE, GotId = FALSE, lines, i, j;
char *Filename, *temp1, *idname = NULL, *Desc[26];
char *Filename, *temp1, *idname = NULL, *Desc[26], *lname, temp[81];
struct stat statfile;
char temp[81];
Filename = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char));
lname = calloc(PATH_MAX, sizeof(char));
sprintf(Filename, "%s/%s", area.Path, File);
@ -872,6 +871,7 @@ int Addfile(char *File, int AreaNum, int fileid)
fclose(pFileDB);
free(Filename);
free(temp1);
free(lname);
return FALSE;
}
@ -885,6 +885,12 @@ int Addfile(char *File, int AreaNum, int fileid)
file.Crc32 = file_crc(Filename, TRUE);
strcpy(file.Uploader, exitinfo.sUserName);
file.UploadDate = time(NULL);
if (strcmp(file.Name, file.LName)) {
sprintf(lname, "%s/%s", area.Path, file.Name);
if (link(Filename, lname)) {
WriteError("$Can't create link %s to %s", lname, Filename);
}
}
if (area.PwdUP) {
colour(9,0);

View File

@ -122,9 +122,8 @@ void EditFile()
void E_F(long areanr)
{
FILE *fil;
char temp[PATH_MAX];
char temp[PATH_MAX], help[81];
int i, y, o, records, Ondisk;
char help[81];
static char *menu = (char *)"0";
long offset;
time_t Time;
@ -171,7 +170,9 @@ void E_F(long areanr)
sprintf(temp, "%s/%s", area.Path, file.LName);
Ondisk = ((stat(temp, &statfile)) != -1);
if (Ondisk)
if (file.Deleted)
set_color(LIGHTBLUE, BLACK);
else if (Ondisk)
set_color(CYAN, BLACK);
else
set_color(LIGHTRED, BLACK);
@ -265,7 +266,6 @@ void E_F(long areanr)
break;
}
}
}
}