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 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: general:
This may become release 0.36.00 (again). 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: mbsebbs:
Several user input functions don't allow comma's anymore. 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: mbfido:
TIC file forwarding now uses a list of qualified systems to TIC file forwarding now uses a list of qualified systems to
forward to, and with this information builds more reliable forward to, and with this information builds more reliable
seen-by lines. 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: mbcico:
With filetransfer errors, the attempts counter was not With filetransfer errors, the attempts counter was not
increased. 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. v0.35.05 19-Oct-2002 - 13-Nov-2002.

View File

@ -267,8 +267,8 @@
266 change.c |Protocol now set to: 266 change.c |Protocol now set to:
267 file.c |Enter keyword to use for Search: 267 file.c |Enter keyword to use for Search:
268 file.c |File Search by Keyword 268 file.c |File Search by Keyword
269 file.c |Accepts wildcards such as : *.zip, *.gz, .tar* 269 file.c |Accepts wildcards such as : *.zip, *.gz, *.*
270 file.c | : *.zip is the same as .zip 270 | : *.zip is the same as .zip
271 file.c |Enter filename to search for : 271 file.c |Enter filename to search for :
272 file.c |File Search by Filename 272 file.c |File Search by Filename
273 file.c YN|Search for new since your last call [Y/n]: 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: |Het protocol is nu:
|Geef sleutelwoord om op te zoeken : |Geef sleutelwoord om op te zoeken :
|Bestanden zoeken op sleutelwoord |Bestanden zoeken op sleutelwoord
|Accepteerd jokers zoals : *.zip, *.gz, .tar* |Accepteerd jokers zoals : *.zip, *.gz, *.*
| : *.zip is hetzelfde als .zip | : *.zip is hetzelfde als .zip
|Geef bestandsnaam om naar te zoeken : |Geef bestandsnaam om naar te zoeken :
|Bestanden zoeken op naam |Bestanden zoeken op naam

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ int Add_BBS()
struct FILERecord frec; struct FILERecord frec;
int rc, i, Insert, Done = FALSE, Found = FALSE; int rc, i, Insert, Done = FALSE, Found = FALSE;
char fdbname[PATH_MAX], fdbtemp[PATH_MAX]; 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; FILE *fdb, *fdt;
int Keep = 0, DidDelete = FALSE; int Keep = 0, DidDelete = FALSE;
fd_list *fdl = NULL; fd_list *fdl = NULL;
@ -142,6 +142,12 @@ int Add_BBS()
return FALSE; return FALSE;
} }
chmod(temp2, 0644); 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); 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); sprintf(temp2, "%s/%s", area.Path, file.LName);
if (unlink(temp2) != 0) if (unlink(temp2) != 0)
WriteError("$Can't unlink file %s", temp2); 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(fdb);
fclose(fdt); fclose(fdt);

View File

@ -52,7 +52,7 @@ extern int do_novir; /* Suppress virus check */
void AdoptFile(int Area, char *File, char *Description) void AdoptFile(int Area, char *File, char *Description)
{ {
FILE *fp; FILE *fp;
char *temp, *temp2, *tmpdir, *unarc, *pwd; char *temp, *temp2, *tmpdir, *unarc, *pwd, *lname;
char Desc[256], TDesc[256]; char Desc[256], TDesc[256];
int IsArchive = FALSE, MustRearc = FALSE, UnPacked = FALSE; int IsArchive = FALSE, MustRearc = FALSE, UnPacked = FALSE;
int IsVirus = FALSE, File_Id = FALSE; int IsVirus = FALSE, File_Id = FALSE;
@ -279,8 +279,17 @@ void AdoptFile(int Area, char *File, char *Description)
fflush(stdout); fflush(stdout);
} }
if (AddFile(fdb, Area, temp2, File) == FALSE) { if (strcmp(fdb.Name, fdb.LName)) {
die(MBERR_GENERAL); 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); Syslog('+', "File %s added to area %d", File, Area);

View File

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

View File

@ -94,7 +94,7 @@ void Delete(int UnDel, int Area, char *File)
colour(CYAN, BLACK); colour(CYAN, BLACK);
while (fread(&fdb, sizeof(fdb), 1, fp) == 1) { 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) { if (UnDel && fdb.Deleted) {
fdb.Deleted = FALSE; fdb.Deleted = FALSE;
Syslog('+', "Marked file %s in area %d for undeletion", File, Area); 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) 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; FILE *fbbs;
int Append = FALSE, Files = 0, rc, i, j = 0, k = 0, x, Doit; int Append = FALSE, Files = 0, rc, i, j = 0, k = 0, x, Doit;
int Imported = 0, Errors = 0, Present = FALSE; int Imported = 0, Errors = 0, Present = FALSE;
@ -73,6 +73,7 @@ void ImportFiles(int Area)
tmpdir = calloc(PATH_MAX, sizeof(char)); tmpdir = calloc(PATH_MAX, sizeof(char));
String = calloc(4096, sizeof(char)); String = calloc(4096, sizeof(char));
dest = calloc(PATH_MAX, sizeof(char)); dest = calloc(PATH_MAX, sizeof(char));
lname = calloc(PATH_MAX, sizeof(char));
getcwd(pwd, PATH_MAX); getcwd(pwd, PATH_MAX);
if (CheckFDB(Area, area.Path)) 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"); printf("Adding \b\b\b\b\b\b\b\b\b\b");
fflush(stdout); fflush(stdout);
} }
if (AddFile(fdb, Area, dest, temp)) { if (strcmp(fdb.Name, fdb.LName)) {
Imported++; if (AddFile(fdb, Area, dest, temp, lname)) {
} else Imported++;
Errors++; } else {
Errors++;
}
} else {
if (AddFile(fdb, Area, dest, temp, NULL)) {
Imported++;
} else {
Errors++;
}
}
} else { } else {
Errors++; Errors++;
} }
@ -252,6 +262,7 @@ void ImportFiles(int Area)
} }
sprintf(dest, "%s/%s", area.Path, fdb.LName); sprintf(dest, "%s/%s", area.Path, fdb.LName);
sprintf(lname, "%s/%s", area.Path, fdb.Name);
Append = TRUE; Append = TRUE;
fdb.Size = statfile.st_size; fdb.Size = statfile.st_size;
fdb.FileDate = statfile.st_mtime; 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"); printf("Adding \b\b\b\b\b\b\b\b\b\b");
fflush(stdout); fflush(stdout);
} }
if (AddFile(fdb, Area, dest, temp)) if (strcmp(fdb.Name, fdb.LName)) {
Imported++; if (AddFile(fdb, Area, dest, temp, lname))
else Imported++;
Errors++; else
Errors++;
} else {
if (AddFile(fdb, Area, dest, temp, NULL))
Imported++;
else
Errors++;
}
} else { } else {
Errors++; Errors++;
} }
} }
free(lname);
free(dest); free(dest);
free(String); free(String);
free(pwd); free(pwd);

View File

@ -52,10 +52,10 @@ extern int do_quiet; /* Suppress screen output */
*/ */
void Move(int From, int To, char *File) void Move(int From, int To, char *File)
{ {
char *frompath, *topath, *temp1, *temp2; char *frompath, *topath, *temp1, *temp2, *fromlink, *tolink;
struct FILERecord fdb; struct FILERecord fdb;
FILE *fp1, *fp2; FILE *fp1, *fp2;
int rc = FALSE; int rc = FALSE, Found = FALSE;
IsDoing("Move file"); IsDoing("Move file");
colour(LIGHTRED, BLACK); colour(LIGHTRED, BLACK);
@ -88,9 +88,35 @@ void Move(int From, int To, char *File)
} }
if (CheckFDB(From, area.Path)) if (CheckFDB(From, area.Path))
die(MBERR_GENERAL); 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 = xstrcpy(area.Path);
frompath = xstrcat(frompath, (char *)"/"); 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 * Check Destination area
@ -113,13 +139,15 @@ void Move(int From, int To, char *File)
} }
if (CheckFDB(To, area.Path)) if (CheckFDB(To, area.Path))
die(MBERR_GENERAL); die(MBERR_GENERAL);
topath = xstrcpy(area.Path); topath = xstrcpy(area.Path);
topath = xstrcat(topath, (char *)"/"); 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)); 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); sprintf(temp2, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), From);
if ((fp1 = fopen(temp1, "r")) == NULL) if ((fp1 = fopen(temp1, "r")) == NULL)
@ -133,11 +161,19 @@ void Move(int From, int To, char *File)
* file. * file.
*/ */
while (fread(&fdb, sizeof(fdb), 1, fp1) == 1) { 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); fwrite(&fdb, sizeof(fdb), 1, fp2);
else { 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) { if (rc) {
/*
* Remove old 8.3 name
*/
if (strcmp(fdb.Name, fdb.LName))
unlink(fromlink);
/* /*
* Try to move thumbnail if it exists * Try to move thumbnail if it exists
*/ */
@ -189,7 +225,9 @@ void Move(int From, int To, char *File)
free(temp1); free(temp1);
free(temp2); free(temp2);
free(frompath); free(frompath);
free(fromlink);
free(topath); free(topath);
free(tolink);
} }

View File

@ -53,113 +53,116 @@ extern int do_index; /* Reindex filebases */
*/ */
void PackFileBase(void) void PackFileBase(void)
{ {
FILE *fp, *pAreas, *pFile; FILE *fp, *pAreas, *pFile;
int i, iAreas, iAreasNew = 0, rc; int i, iAreas, iAreasNew = 0, rc, iTotal = 0, iRemoved = 0;
int iTotal = 0, iRemoved = 0; char *sAreas, *fAreas, *fTmp, fn[PATH_MAX];
char *sAreas, *fAreas, *fTmp, fn[PATH_MAX];
sAreas = calloc(PATH_MAX, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
fAreas = calloc(PATH_MAX, sizeof(char)); fAreas = calloc(PATH_MAX, sizeof(char));
fTmp = calloc(PATH_MAX, sizeof(char)); fTmp = calloc(PATH_MAX, sizeof(char));
IsDoing("Pack filebase"); IsDoing("Pack filebase");
if (!do_quiet) { if (!do_quiet) {
colour(3, 0); colour(3, 0);
printf("Packing file database...\n"); printf("Packing file database...\n");
} }
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT")); sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);
die(MBERR_INIT_ERROR); die(MBERR_INIT_ERROR);
} }
fread(&areahdr, sizeof(areahdr), 1, pAreas); fread(&areahdr, sizeof(areahdr), 1, pAreas);
fseek(pAreas, 0, SEEK_END); fseek(pAreas, 0, SEEK_END);
iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize; iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize;
for (i = 1; i <= iAreas; i++) { for (i = 1; i <= iAreas; i++) {
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET); fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
fread(&area, areahdr.recsize, 1, pAreas); fread(&area, areahdr.recsize, 1, pAreas);
if (area.Available && !area.CDrom) { if (area.Available && !area.CDrom) {
if (!diskfree(CFG.freespace)) if (!diskfree(CFG.freespace))
die(MBERR_DISK_FULL); die(MBERR_DISK_FULL);
if (!do_quiet) { if (!do_quiet) {
printf("\r%4d => %-44s", i, area.Name); printf("\r%4d => %-44s", i, area.Name);
fflush(stdout);
}
Marker();
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
sprintf(fTmp, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), i);
if ((pFile = fopen(fAreas, "r")) == NULL) {
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(MBERR_GENERAL);
}
}
if ((fp = fopen(fTmp, "a+")) == NULL) {
WriteError("$Can't create %s", fTmp);
die(MBERR_GENERAL);
}
while (fread(&file, sizeof(file), 1, pFile) == 1) {
iTotal++;
if ((!file.Deleted) && (!file.Double) && (strcmp(file.Name, "") != 0)) {
fwrite(&file, sizeof(file), 1, fp);
} else {
iRemoved++;
if (file.Double) {
Syslog('+', "Removed double record file \"%s\" from area %d", file.LName, i);
} else {
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);
/*
* If a dotted version (thumbnail) exists, remove it silently
*/
sprintf(fn, "%s/.%s", area.Path, file.LName);
unlink(fn);
}
do_index = TRUE;
}
}
fclose(fp);
fclose(pFile);
if ((rename(fTmp, fAreas)) == 0) {
unlink(fTmp);
chmod(fAreas, 00660);
}
iAreasNew++;
} /* if area.Available */
}
fclose(pAreas);
Syslog('+', "Pack Areas [%5d] Files [%5d] Removed [%5d]", iAreasNew, iTotal, iRemoved);
if (!do_quiet) {
printf("\r \r");
fflush(stdout); fflush(stdout);
} }
Marker();
free(fTmp); sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
free(sAreas); sprintf(fTmp, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), i);
free(fAreas);
if ((pFile = fopen(fAreas, "r")) == NULL) {
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(MBERR_GENERAL);
}
}
if ((fp = fopen(fTmp, "a+")) == NULL) {
WriteError("$Can't create %s", fTmp);
die(MBERR_GENERAL);
}
while (fread(&file, sizeof(file), 1, pFile) == 1) {
iTotal++;
if ((!file.Deleted) && (!file.Double) && (strcmp(file.Name, "") != 0)) {
fwrite(&file, sizeof(file), 1, fp);
} else {
iRemoved++;
if (file.Double) {
Syslog('+', "Removed double record file \"%s\" from area %d", file.LName, i);
} else {
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);
/*
* If a dotted version (thumbnail) exists, remove it silently
*/
sprintf(fn, "%s/.%s", area.Path, file.LName);
unlink(fn);
}
do_index = TRUE;
}
}
fclose(fp);
fclose(pFile);
if ((rename(fTmp, fAreas)) == 0) {
unlink(fTmp);
chmod(fAreas, 00660);
}
iAreasNew++;
} /* if area.Available */
}
fclose(pAreas);
Syslog('+', "Pack Areas [%5d] Files [%5d] Removed [%5d]", iAreasNew, iTotal, iRemoved);
if (!do_quiet) {
printf("\r \r");
fflush(stdout);
}
free(fTmp);
free(sAreas);
free(fAreas);
} }

View File

@ -309,12 +309,16 @@ int UnpackFile(char *File)
* directory. The fdb record already has all needed * directory. The fdb record already has all needed
* information. * 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; char *temp1, *temp2;
FILE *fp1, *fp2; FILE *fp1, *fp2;
int i, rc, Insert, Done = FALSE, Found = FALSE; 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); mkdirs(DestPath, 0775);
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");
@ -323,6 +327,15 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath)
return FALSE; return FALSE;
} }
chmod(DestPath, 0644); 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)); temp1 = calloc(PATH_MAX, sizeof(char));
temp2 = 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 Marker(void); /* Eyecatcher */
void DeleteVirusWork(void); /* Delete unarc directory */ void DeleteVirusWork(void); /* Delete unarc directory */
int UnpackFile(char *File); /* Unpack archive */ 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 CheckFDB(int, char *); /* Check FDB of area */
int LoadAreaRec(int); /* Load Area record */ 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 * If the file is converted, we set the date of the original
* received file as the file creation date. * received file as the file creation date.
*/ */
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewName);
if ((MustRearc || DidBanner) && CFG.ct_KeepDate) { if ((MustRearc || DidBanner) && CFG.ct_KeepDate) {
if ((tic.Touch) && (tic.FileArea)) { if ((tic.Touch) && (tic.FileArea)) {
ut.actime = mktime(localtime(&TIC.FileDate)); ut.actime = mktime(localtime(&TIC.FileDate));
ut.modtime = mktime(localtime(&TIC.FileDate)); ut.modtime = mktime(localtime(&TIC.FileDate));
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewName);
utime(Temp, &ut); utime(Temp, &ut);
Syslog('-', "Restamp filedate %s to %s", Temp, rfcdate(ut.modtime)); 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) { if (tic.FileArea) {
Syslog('+', "Import: %s Area: %s", TIC.NewName, TIC.TicIn.Area); Syslog('+', "Import: %s Area: %s", TIC.NewName, TIC.TicIn.Area);
@ -795,21 +803,6 @@ int ProcessTic(fa_list *sbl)
tic_out++; 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(); Magic_ExecCommand();
@ -818,8 +811,8 @@ int ProcessTic(fa_list *sbl)
Magic_AdoptFile(); Magic_AdoptFile();
sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName); sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName);
unlink(Temp); unlink(Temp);
free(Temp); free(Temp);
tidy_qualify(&qal); tidy_qualify(&qal);
return 0; return 0;

View File

@ -712,149 +712,129 @@ int KeywordScan()
*/ */
int FilenameScan() int FilenameScan()
{ {
FILE *pAreas, *pFile; FILE *pAreas, *pFile;
int z, y, Found, Count = 0; int Found, Count = 0;
char *Name; char *p, *q, mask[256];
char *tmpname, *tmpname2; char *Name;
char temp[81]; _Tag T;
_Tag T; unsigned long OldArea;
unsigned long OldArea;
Name = calloc(81, sizeof(char)); Name = calloc(81, sizeof(char));
tmpname = calloc(81, sizeof(char)); OldArea = iAreaNumber;
tmpname2 = calloc(81, sizeof(char));
OldArea = iAreaNumber;
iLineCount = 2; /* Reset Line Counter to Zero */ iLineCount = 2; /* Reset Line Counter to Zero */
arecno = 1; /* Reset Area Number to One */ arecno = 1; /* Reset Area Number to One */
Enter(2); Enter(2);
/* Accepts wildcards such as : *.zip, *.gz, .tar */ /* Accepts wildcards such as : *.zip, *.gz, *.* */
pout(15, 0, (char *) Language(269)); pout(15, 0, (char *) Language(269));
Enter(1);
/* : *.zip is the same as .zip */
pout(15, 0, (char *) Language(270));
Enter(2); Enter(2);
/* Enter filename to search for : */ /* Enter filename to search for : */
pout(11, 0, (char *) Language(271)); pout(11, 0, (char *) Language(271));
colour(CFG.InputColourF, CFG.InputColourB); colour(CFG.InputColourF, CFG.InputColourB);
GetstrC(Name, 80); GetstrC(Name, 80);
if ((strcmp(Name, "")) == 0) { 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.
*/
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);
}
}
tl(Name);
Syslog('+', "FilenameScan(): \"%s\"", Name);
clear();
/* File Search by Filename */
pout(15, 0, (char *) Language(272));
Enter(1);
InitTag();
if ((pAreas = OpenFareas(FALSE)) == NULL)
return 0;
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) && (strlen(area.Password) == 0)) {
if ((pFile = OpenFileBase(arecno, FALSE)) != NULL) {
Found = FALSE;
Sheader();
Nopper();
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 (!Found) {
Enter(2);
if (iLC(2) == 1) {
free(Name);
free(tmpname);
free(tmpname2);
SetFileArea(OldArea);
return 1;
}
Found = TRUE;
}
memset(&T, 0, sizeof(T));
T.Area = arecno;
T.Active = FALSE;
T.Cost = file.Cost;
T.Size = file.Size;
strncpy(T.SFile, file.Name, 12);
strncpy(T.LFile, file.LName, 81);
SetTag(T);
Count++;
if (ShowOneFile() == 1) {
free(Name);
free(tmpname);
free(tmpname2);
SetFileArea(OldArea);
return 1;
}
}
} /* End of while */
fclose(pFile);
if (Found) {
Enter(2);
if (iLC(2) == 1) {
free(Name);
free(tmpname);
free(tmpname2);
SetFileArea(OldArea);
return 1;
}
}
} /* End Check for LTSec */
} /* if access */
arecno++; /* Go to next file area */
} /* End of Main */
Syslog('+', "Found %d files", Count);
fclose(pAreas);
free(Name); free(Name);
free(tmpname); return 0;
free(tmpname2); }
printf("\n");
if (Count) /*
Mark(); * Make a regexp string for the users search mask.
else */
Pause(); p = tl(Name);
SetFileArea(OldArea); q = mask;
return 1; *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++;
}
*q++ = '$';
*q++ = '\0';
Syslog('+', "FilenameScan(): \"%s\" -> \"%s\"", Name, mask);
free(Name);
re_comp(mask);
clear();
/* File Search by Filename */
pout(15, 0, (char *) Language(272));
Enter(1);
InitTag();
if ((pAreas = OpenFareas(FALSE)) == NULL)
return 0;
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) && (strlen(area.Password) == 0)) {
if ((pFile = OpenFileBase(arecno, FALSE)) != NULL) {
Found = FALSE;
Sheader();
Nopper();
while (fread(&file, sizeof(file), 1, pFile) == 1) {
if (re_exec(file.Name) || re_exec(file.LName)) {
if (!Found) {
Enter(2);
if (iLC(2) == 1) {
SetFileArea(OldArea);
return 1;
}
Found = TRUE;
}
memset(&T, 0, sizeof(T));
T.Area = arecno;
T.Active = FALSE;
T.Cost = file.Cost;
T.Size = file.Size;
strncpy(T.SFile, file.Name, 12);
strncpy(T.LFile, file.LName, 81);
SetTag(T);
Count++;
if (ShowOneFile() == 1) {
SetFileArea(OldArea);
return 1;
}
}
} /* End of while */
fclose(pFile);
if (Found) {
Enter(2);
if (iLC(2) == 1) {
SetFileArea(OldArea);
return 1;
}
}
} /* End Check for LTSec */
} /* if access */
arecno++; /* Go to next file area */
} /* End of Main */
Syslog('+', "Found %d files", Count);
fclose(pAreas);
printf("\n");
if (Count)
Mark();
else
Pause();
SetFileArea(OldArea);
return 1;
} }

View File

@ -847,13 +847,12 @@ int Addfile(char *File, int AreaNum, int fileid)
{ {
FILE *id, *pFileDB, *pPrivate; FILE *id, *pFileDB, *pPrivate;
int err = 1, iDesc = 1, iPrivate = FALSE, GotId = FALSE, lines, i, j; 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; struct stat statfile;
char temp[81];
Filename = calloc(PATH_MAX, sizeof(char)); Filename = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char)); temp1 = calloc(PATH_MAX, sizeof(char));
lname = calloc(PATH_MAX, sizeof(char));
sprintf(Filename, "%s/%s", area.Path, File); sprintf(Filename, "%s/%s", area.Path, File);
@ -863,7 +862,7 @@ int Addfile(char *File, int AreaNum, int fileid)
* if it fails it will return a zero which will not * if it fails it will return a zero which will not
* increase his uploads stats * increase his uploads stats
*/ */
if(stat(Filename, &statfile) != 0) { if (stat(Filename, &statfile) != 0) {
colour(10, 0); colour(10, 0);
/* Upload was unsuccessful for: */ /* Upload was unsuccessful for: */
@ -872,6 +871,7 @@ int Addfile(char *File, int AreaNum, int fileid)
fclose(pFileDB); fclose(pFileDB);
free(Filename); free(Filename);
free(temp1); free(temp1);
free(lname);
return FALSE; return FALSE;
} }
@ -885,6 +885,12 @@ int Addfile(char *File, int AreaNum, int fileid)
file.Crc32 = file_crc(Filename, TRUE); file.Crc32 = file_crc(Filename, TRUE);
strcpy(file.Uploader, exitinfo.sUserName); strcpy(file.Uploader, exitinfo.sUserName);
file.UploadDate = time(NULL); 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) { if (area.PwdUP) {
colour(9,0); colour(9,0);

View File

@ -121,152 +121,152 @@ void EditFile()
void E_F(long areanr) void E_F(long areanr)
{ {
FILE *fil; FILE *fil;
char temp[PATH_MAX]; char temp[PATH_MAX], help[81];
int i, y, o, records, Ondisk; int i, y, o, records, Ondisk;
char help[81]; static char *menu = (char *)"0";
static char *menu = (char *)"0"; long offset;
long offset; time_t Time;
time_t Time; struct stat statfile;
struct stat statfile; unsigned long crc, crc1;
unsigned long crc, crc1;
clr_index();
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), areanr);
if ((fil = fopen(temp, "r+")) == NULL) {
working(2, 0, 0);
return;
}
if (! check_free())
return;
fseek(fil, 0, SEEK_END);
records = ftell(fil) / sizeof(file);
o = 0;
for (;;) {
clr_index(); clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 4, "14. EDIT FILES DATABASE");
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), areanr); y = 8;
if ((fil = fopen(temp, "r+")) == NULL) { working(1, 0, 0);
working(2, 0, 0);
return;
}
if (! check_free())
return;
fseek(fil, 0, SEEK_END); set_color(YELLOW, BLUE);
records = ftell(fil) / sizeof(file); mvprintw(7, 1, " Nr Filename Size Date Time Description ");
o = 0; /* 1234 12345678901234 12345678 12-34-1998 12:45 123456789012345678901234567890*/
set_color(CYAN, BLACK);
for (;;) { for (i = 1; i <= 10; i++) {
if ((o + i) <= records) {
offset = ((o + i) - 1) * sizeof(file);
fseek(fil, offset, SEEK_SET);
fread(&file, sizeof(file), 1, fil);
clr_index();
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mvprintw(5, 4, "14. EDIT FILES DATABASE"); mvprintw(y, 1, (char *)"%4d.", o + i);
y = 8; sprintf(temp, "%s/%s", area.Path, file.LName);
working(1, 0, 0); Ondisk = ((stat(temp, &statfile)) != -1);
set_color(YELLOW, BLUE); if (file.Deleted)
mvprintw(7, 1, " Nr Filename Size Date Time Description "); set_color(LIGHTBLUE, BLACK);
/* 1234 12345678901234 12345678 12-34-1998 12:45 123456789012345678901234567890*/ else if (Ondisk)
set_color(CYAN, BLACK); set_color(CYAN, BLACK);
for (i = 1; i <= 10; i++) {
if ((o + i) <= records) {
offset = ((o + i) - 1) * sizeof(file);
fseek(fil, offset, SEEK_SET);
fread(&file, sizeof(file), 1, fil);
set_color(WHITE, BLACK);
mvprintw(y, 1, (char *)"%4d.", o + i);
sprintf(temp, "%s/%s", area.Path, file.LName);
Ondisk = ((stat(temp, &statfile)) != -1);
if (Ondisk)
set_color(CYAN, BLACK);
else
set_color(LIGHTRED, BLACK);
mvprintw(y, 8, (char *)"%-14s", file.Name);
if (Ondisk) {
if (file.Size == statfile.st_size)
set_color(CYAN, BLACK);
else
set_color(LIGHTRED, BLACK);
mvprintw(y,23, (char *)"%8ld", file.Size);
if (file.FileDate == statfile.st_mtime)
set_color(CYAN, BLACK);
else
set_color(LIGHTRED, BLACK);
Time = file.FileDate;
mvprintw(y,32, (char *)"%s %s", StrDateDMY(Time), StrTimeHM(Time));
}
set_color(CYAN, BLACK);
sprintf(temp, "%s", file.Desc[0]);
temp[30] = '\0';
mvprintw(y,49, (char *)"%s", temp);
y++;
}
}
working(0, 0, 0);
if (records)
if (records > 10)
sprintf(help, "^1..%d^ Edit, ^-^ Return, ^N^/^P^ Page", records);
else
sprintf(help, "^1..%d^ Edit, ^-^ Return", records);
else else
sprintf(help, "^-^ Return"); set_color(LIGHTRED, BLACK);
mvprintw(y, 8, (char *)"%-14s", file.Name);
showhelp(help); if (Ondisk) {
if (file.Size == statfile.st_size)
set_color(CYAN, BLACK);
else
set_color(LIGHTRED, BLACK);
mvprintw(y,23, (char *)"%8ld", file.Size);
while(TRUE) { if (file.FileDate == statfile.st_mtime)
mvprintw(LINES - 4, 6, "Enter your choice >"); set_color(CYAN, BLACK);
menu = (char *)"-"; else
menu = edit_field(LINES - 4, 26, 6, '!', menu); set_color(LIGHTRED, BLACK);
locate(LINES - 4, 6); Time = file.FileDate;
clrtoeol(); mvprintw(y,32, (char *)"%s %s", StrDateDMY(Time), StrTimeHM(Time));
if (strncmp(menu, "-", 1) == 0) {
fclose(fil);
open_bbs();
return;
}
if (records > 10) {
if (strncmp(menu, "N", 1) == 0)
if ((o + 10) < records) {
o += 10;
break;
}
if (strncmp(menu, "P", 1) == 0)
if ((o - 10) >= 0) {
o -= 10;
break;
}
}
if ((atoi(menu) > 0) && (atoi(menu) <= records)) {
working(1, 0, 0);
offset = (atoi(menu) - 1) * sizeof(file);
fseek(fil, offset, SEEK_SET);
fread(&file, sizeof(file), 1, fil);
crc = 0xffffffff;
crc = upd_crc32((char *)&file, crc, sizeof(file));
sprintf(temp, "%s/%s", area.Path, file.LName);
if (stat(temp, &statfile) == -1)
file.Missing = TRUE;
EditFile();
crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&file, crc1, sizeof(file));
if (crc != crc1) {
if (yes_no((char *)"Record is changed, save") == 1) {
working(1, 0, 0);
fseek(fil, offset, SEEK_SET);
fwrite(&file, sizeof(file), 1, fil);
}
}
break;
}
} }
set_color(CYAN, BLACK);
sprintf(temp, "%s", file.Desc[0]);
temp[30] = '\0';
mvprintw(y,49, (char *)"%s", temp);
y++;
}
} }
working(0, 0, 0);
if (records)
if (records > 10)
sprintf(help, "^1..%d^ Edit, ^-^ Return, ^N^/^P^ Page", records);
else
sprintf(help, "^1..%d^ Edit, ^-^ Return", records);
else
sprintf(help, "^-^ Return");
showhelp(help);
while(TRUE) {
mvprintw(LINES - 4, 6, "Enter your choice >");
menu = (char *)"-";
menu = edit_field(LINES - 4, 26, 6, '!', menu);
locate(LINES - 4, 6);
clrtoeol();
if (strncmp(menu, "-", 1) == 0) {
fclose(fil);
open_bbs();
return;
}
if (records > 10) {
if (strncmp(menu, "N", 1) == 0)
if ((o + 10) < records) {
o += 10;
break;
}
if (strncmp(menu, "P", 1) == 0)
if ((o - 10) >= 0) {
o -= 10;
break;
}
}
if ((atoi(menu) > 0) && (atoi(menu) <= records)) {
working(1, 0, 0);
offset = (atoi(menu) - 1) * sizeof(file);
fseek(fil, offset, SEEK_SET);
fread(&file, sizeof(file), 1, fil);
crc = 0xffffffff;
crc = upd_crc32((char *)&file, crc, sizeof(file));
sprintf(temp, "%s/%s", area.Path, file.LName);
if (stat(temp, &statfile) == -1)
file.Missing = TRUE;
EditFile();
crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&file, crc1, sizeof(file));
if (crc != crc1) {
if (yes_no((char *)"Record is changed, save") == 1) {
working(1, 0, 0);
fseek(fil, offset, SEEK_SET);
fwrite(&file, sizeof(file), 1, fil);
}
}
break;
}
}
}
} }