2001-11-18 23:19:08 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
* Purpose: File Database Maintenance - utilities
|
|
|
|
*
|
|
|
|
*****************************************************************************
|
2007-03-07 20:05:29 +00:00
|
|
|
* Copyright (C) 1997-2007
|
2001-11-18 23:19:08 +00:00
|
|
|
*
|
|
|
|
* Michiel Broek FIDO: 2:280/2802
|
|
|
|
* Beekmansbos 10
|
|
|
|
* 1971 BV IJmuiden
|
|
|
|
* the Netherlands
|
|
|
|
*
|
|
|
|
* This file is part of MBSE BBS.
|
|
|
|
*
|
|
|
|
* This BBS is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
2003-08-15 20:05:34 +00:00
|
|
|
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
2001-11-18 23:19:08 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2002-06-30 12:48:44 +00:00
|
|
|
#include "../config.h"
|
2004-02-21 17:22:00 +00:00
|
|
|
#include "../lib/mbselib.h"
|
2002-01-07 19:16:03 +00:00
|
|
|
#include "../lib/users.h"
|
2004-02-21 17:22:00 +00:00
|
|
|
#include "../lib/mbsedb.h"
|
2001-11-18 23:19:08 +00:00
|
|
|
#include "mbfutil.h"
|
|
|
|
#include "mbfile.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-06-19 20:31:35 +00:00
|
|
|
extern int do_quiet; /* Suppress screen output */
|
2005-05-07 09:36:05 +00:00
|
|
|
extern int do_force; /* Force file overwrite */
|
2001-11-18 23:19:08 +00:00
|
|
|
extern int e_pid; /* Pid of external process */
|
|
|
|
extern time_t t_start; /* Start time */
|
|
|
|
extern time_t t_end; /* End time */
|
|
|
|
int marker = 0; /* Marker counter */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProgName(void)
|
|
|
|
{
|
|
|
|
if (do_quiet)
|
|
|
|
return;
|
|
|
|
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(WHITE, BLACK);
|
2001-11-18 23:19:08 +00:00
|
|
|
printf("\nMBFILE: MBSE BBS %s File maintenance utility\n", VERSION);
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(YELLOW, BLACK);
|
2001-11-18 23:19:08 +00:00
|
|
|
printf(" %s\n", COPYRIGHT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void die(int onsig)
|
|
|
|
{
|
2003-08-03 14:42:12 +00:00
|
|
|
/*
|
|
|
|
* First check if a child is running, if so, kill it.
|
|
|
|
*/
|
|
|
|
if (e_pid) {
|
|
|
|
if ((kill(e_pid, SIGTERM)) == 0)
|
|
|
|
Syslog('+', "SIGTERM to pid %d succeeded", e_pid);
|
|
|
|
else {
|
|
|
|
if ((kill(e_pid, SIGKILL)) == 0)
|
|
|
|
Syslog('+', "SIGKILL to pid %d succeded", e_pid);
|
|
|
|
else
|
|
|
|
WriteError("$Failed to kill pid %d", e_pid);
|
2001-11-18 23:19:08 +00:00
|
|
|
}
|
|
|
|
|
2003-08-03 14:42:12 +00:00
|
|
|
/*
|
|
|
|
* In case the child had the tty in raw mode...
|
|
|
|
*/
|
|
|
|
if (!do_quiet)
|
2004-03-02 20:47:23 +00:00
|
|
|
execute_pth((char *)"stty", (char *)"sane", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
2003-08-03 14:42:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
signal(onsig, SIG_IGN);
|
|
|
|
|
|
|
|
if (onsig) {
|
|
|
|
if (onsig <= NSIG)
|
|
|
|
WriteError("Terminated on signal %d (%s)", onsig, SigName[onsig]);
|
|
|
|
else
|
|
|
|
WriteError("Terminated with error %d", onsig);
|
|
|
|
}
|
|
|
|
|
2005-12-03 14:52:34 +00:00
|
|
|
clean_tmpwork();
|
2003-08-03 14:42:12 +00:00
|
|
|
ulockprogram((char *)"mbfile");
|
|
|
|
t_end = time(NULL);
|
|
|
|
Syslog(' ', "MBFILE finished in %s", t_elapsed(t_start, t_end));
|
|
|
|
|
|
|
|
if (!do_quiet) {
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(LIGHTGRAY, BLACK);
|
2003-08-03 14:42:12 +00:00
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
ExitClient(onsig);
|
2001-11-18 23:19:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Help(void)
|
|
|
|
{
|
2003-11-08 15:30:04 +00:00
|
|
|
do_quiet = FALSE;
|
|
|
|
ProgName();
|
|
|
|
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(LIGHTCYAN, BLACK);
|
2003-11-08 15:30:04 +00:00
|
|
|
printf("Usage: mbfile [command] <options>\n\n");
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(LIGHTBLUE, BLACK);
|
2003-11-08 15:30:04 +00:00
|
|
|
printf(" Commands are:\n\n");
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(CYAN, BLACK);
|
2007-06-08 18:56:04 +00:00
|
|
|
printf(" a adopt <area> <file> \"[desc]\" Adopt file to area\n");
|
2004-05-04 14:31:25 +00:00
|
|
|
printf(" c check [area] Check filebase\n");
|
2004-03-08 22:25:22 +00:00
|
|
|
printf(" d delete <area> \"<filemask>\" Mark file(s) in area for deletion\n");
|
2003-11-08 15:30:04 +00:00
|
|
|
printf(" im import <area> Import files in current dir to area\n");
|
|
|
|
printf(" in index Create filerequest index\n");
|
|
|
|
printf(" k kill Kill/move old files\n");
|
|
|
|
printf(" l list [area] List file areas or one area\n");
|
|
|
|
printf(" m move <from> <to> <file> Move file from to area\n");
|
|
|
|
printf(" p pack Pack filebase\n");
|
2004-03-08 22:25:22 +00:00
|
|
|
printf(" r rearc <area> \"<filemask>\" Rearc file(s) in area to area archive type\n");
|
2003-11-08 15:30:04 +00:00
|
|
|
printf(" s sort <area> Sort files in a file area\n");
|
|
|
|
printf(" t toberep Show toberep database\n");
|
2004-03-08 22:25:22 +00:00
|
|
|
printf(" u undelete <area> \"<filemask>\" Mark file(s) in area for undeletion\n");
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(LIGHTBLUE, BLACK);
|
2003-11-08 15:30:04 +00:00
|
|
|
printf("\n Options are:\n\n");
|
2004-10-27 11:08:09 +00:00
|
|
|
mbse_colour(CYAN, BLACK);
|
2003-11-08 15:30:04 +00:00
|
|
|
printf(" -a -announce Suppress announce added files\n");
|
2005-05-07 09:36:05 +00:00
|
|
|
printf(" -f -force Force file overwrite\n");
|
2003-11-08 15:30:04 +00:00
|
|
|
printf(" -q -quiet Quiet mode\n");
|
|
|
|
printf(" -v -virus Suppress virus scanning, use with care\n");
|
|
|
|
die(MBERR_COMMANDLINE);
|
2001-11-18 23:19:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Marker(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Keep the connection with the server alive
|
|
|
|
*/
|
|
|
|
Nopper();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Release system resources when running in the background
|
|
|
|
*/
|
|
|
|
if (CFG.slow_util && do_quiet)
|
2004-01-25 10:57:35 +00:00
|
|
|
msleep(1);
|
2001-11-18 23:19:08 +00:00
|
|
|
|
|
|
|
if (do_quiet)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (marker) {
|
|
|
|
case 0: printf(">---");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: printf(">>--");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: printf(">>>-");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: printf(">>>>");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: printf("<>>>");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5: printf("<<>>");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6: printf("<<<>");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7: printf("<<<<");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8: printf("-<<<");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 9: printf("--<<");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:printf("---<");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 11:printf("----");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
printf("\b\b\b\b");
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
if (marker < 11)
|
|
|
|
marker++;
|
|
|
|
else
|
|
|
|
marker = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-11-25 12:18:18 +00:00
|
|
|
int UnpackFile(char *File)
|
|
|
|
{
|
|
|
|
char *temp, *pwd, *unarc, *cmd;
|
|
|
|
|
|
|
|
Syslog('f', "UnpackFile(%s)", File);
|
|
|
|
|
|
|
|
if ((unarc = unpacker(File)) == NULL) {
|
2002-02-08 14:25:34 +00:00
|
|
|
Syslog('f', "Unknown archive format %s", File);
|
2001-11-25 12:18:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
pwd = calloc(PATH_MAX, sizeof(char));
|
|
|
|
getcwd(pwd, PATH_MAX);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check if there is a temp directory to unpack the archive.
|
|
|
|
*/
|
2005-12-03 14:52:34 +00:00
|
|
|
if (create_tmpwork()) {
|
2006-01-06 20:06:57 +00:00
|
|
|
snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
2005-12-03 14:52:34 +00:00
|
|
|
if (!do_quiet)
|
|
|
|
printf("\nCan't create %s\n", temp);
|
|
|
|
die(MBERR_GENERAL);
|
2001-11-25 12:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!getarchiver(unarc)) {
|
|
|
|
WriteError("No archiver available for %s", File);
|
|
|
|
if (!do_quiet)
|
2003-11-15 12:31:05 +00:00
|
|
|
printf("\nNo archiver available for %s\n", File);
|
2006-01-06 20:06:57 +00:00
|
|
|
clean_tmpwork();
|
2001-11-25 12:18:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd = xstrcpy(archiver.funarc);
|
|
|
|
if ((cmd == NULL) || (cmd == "")) {
|
|
|
|
WriteError("No unarc command available");
|
|
|
|
if (!do_quiet)
|
2003-11-15 12:31:05 +00:00
|
|
|
printf("\nNo unarc command available\n");
|
2006-01-06 20:06:57 +00:00
|
|
|
clean_tmpwork();
|
2001-11-25 12:18:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-12-03 14:52:34 +00:00
|
|
|
snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
2001-11-25 12:18:18 +00:00
|
|
|
if (chdir(temp) != 0) {
|
|
|
|
WriteError("$Can't change to %s", temp);
|
2006-01-06 20:06:57 +00:00
|
|
|
clean_tmpwork();
|
2002-10-20 20:58:55 +00:00
|
|
|
die(MBERR_GENERAL);
|
2001-11-25 12:18:18 +00:00
|
|
|
}
|
|
|
|
|
2004-03-02 20:47:23 +00:00
|
|
|
if (execute_str(cmd, File, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
|
2001-11-25 12:18:18 +00:00
|
|
|
chdir(pwd);
|
|
|
|
free(temp);
|
|
|
|
free(pwd);
|
|
|
|
free(cmd);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-01-06 20:06:57 +00:00
|
|
|
|
|
|
|
chdir(pwd);
|
|
|
|
WriteError("Unpack error, file may be corrupt");
|
|
|
|
clean_tmpwork();
|
2001-11-25 12:18:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-03-06 21:48:41 +00:00
|
|
|
* Add file to the BBS. The file is in the current directory.
|
|
|
|
* The f_db record already has all needed information.
|
2001-11-25 12:18:18 +00:00
|
|
|
*/
|
2004-03-06 21:48:41 +00:00
|
|
|
int AddFile(struct FILE_record f_db, int Area, char *DestPath, char *FromPath, char *LinkPath)
|
2001-11-25 12:18:18 +00:00
|
|
|
{
|
2007-03-07 20:05:29 +00:00
|
|
|
int rc;
|
2004-05-05 14:21:15 +00:00
|
|
|
struct _fdbarea *fdb_area = NULL;
|
2007-03-07 20:05:29 +00:00
|
|
|
char *temp, *dest, *lnk;
|
2001-11-25 12:18:18 +00:00
|
|
|
|
2004-12-22 12:12:10 +00:00
|
|
|
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));
|
|
|
|
|
2002-11-23 16:48:54 +00:00
|
|
|
/*
|
|
|
|
* Copy file to the final destination and make a hard link with the
|
|
|
|
* 8.3 filename to the long filename.
|
|
|
|
*/
|
2002-05-24 18:06:14 +00:00
|
|
|
mkdirs(DestPath, 0775);
|
2003-11-15 12:31:05 +00:00
|
|
|
|
2005-01-02 14:53:08 +00:00
|
|
|
if ((file_exist(DestPath, F_OK) == 0) || (file_exist(LinkPath, F_OK) == 0)) {
|
2005-05-07 09:36:05 +00:00
|
|
|
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;
|
|
|
|
}
|
2003-11-15 12:31:05 +00:00
|
|
|
}
|
|
|
|
|
2002-05-10 18:14:27 +00:00
|
|
|
if ((rc = file_cp(FromPath, DestPath))) {
|
2005-05-07 09:36:05 +00:00
|
|
|
WriteError("Can't copy file to %s, %s", DestPath, strerror(rc));
|
2002-05-10 18:14:27 +00:00
|
|
|
if (!do_quiet)
|
2003-11-15 12:31:05 +00:00
|
|
|
printf("\nCan't copy file to %s, %s\n", DestPath, strerror(rc));
|
2001-11-25 12:18:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2007-03-07 20:05:29 +00:00
|
|
|
|
2002-01-26 21:46:37 +00:00
|
|
|
chmod(DestPath, 0644);
|
2002-11-23 16:48:54 +00:00
|
|
|
if (LinkPath) {
|
2007-03-07 20:05:29 +00:00
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
if (getcwd(temp, PATH_MAX-1)) {
|
|
|
|
if (chdir(area.Path)) {
|
|
|
|
WriteError("$Can't chdir to %s", area.Path);
|
|
|
|
free(temp);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
unlink(LinkPath);
|
|
|
|
dest = xstrcpy(basename(DestPath));
|
|
|
|
lnk = xstrcpy(basename(LinkPath));
|
|
|
|
if ((rc = symlink(dest, lnk))) {
|
|
|
|
WriteError("Can't create symbolic link %s", lnk);
|
|
|
|
if (!do_quiet)
|
|
|
|
printf("\nCan't create symbolic link %s, %s\n", lnk, strerror(rc));
|
|
|
|
unlink(DestPath);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
free(dest);
|
|
|
|
free(lnk);
|
|
|
|
chdir(temp);
|
2002-11-23 16:48:54 +00:00
|
|
|
}
|
2007-03-07 20:05:29 +00:00
|
|
|
free(temp);
|
2002-11-23 16:48:54 +00:00
|
|
|
}
|
2001-11-25 12:18:18 +00:00
|
|
|
|
2004-05-05 14:21:15 +00:00
|
|
|
if ((fdb_area = mbsedb_OpenFDB(Area, 30))) {
|
|
|
|
rc = mbsedb_InsertFDB(fdb_area, f_db, TRUE);
|
|
|
|
mbsedb_CloseFDB(fdb_area);
|
|
|
|
return rc;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-11-25 12:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int CheckFDB(int Area, char *Path)
|
|
|
|
{
|
|
|
|
char *temp;
|
|
|
|
FILE *fp;
|
|
|
|
int rc = FALSE;
|
|
|
|
|
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
2005-08-28 14:10:06 +00:00
|
|
|
snprintf(temp, PATH_MAX, "%s/var/fdb/file%d.data", getenv("MBSE_ROOT"), Area);
|
2001-11-25 12:18:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Open the file database, create new one if it doesn't excist.
|
|
|
|
*/
|
|
|
|
if ((fp = fopen(temp, "r+")) == NULL) {
|
|
|
|
Syslog('!', "Creating new %s", temp);
|
|
|
|
if ((fp = fopen(temp, "a+")) == NULL) {
|
|
|
|
WriteError("$Can't create %s", temp);
|
|
|
|
rc = TRUE;
|
|
|
|
} else {
|
2004-03-07 11:24:21 +00:00
|
|
|
fdbhdr.hdrsize = sizeof(fdbhdr);
|
|
|
|
fdbhdr.recsize = sizeof(fdb);
|
|
|
|
fwrite(&fdbhdr, sizeof(fdbhdr), 1, fp);
|
2001-11-25 12:18:18 +00:00
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
} else {
|
2004-03-07 11:24:21 +00:00
|
|
|
fread(&fdbhdr, sizeof(fdbhdr), 1, fp);
|
2001-11-25 12:18:18 +00:00
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the right attributes
|
|
|
|
*/
|
|
|
|
chmod(temp, 0660);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now check the download directory
|
|
|
|
*/
|
|
|
|
if (access(Path, W_OK) == -1) {
|
2005-08-28 14:10:06 +00:00
|
|
|
snprintf(temp, PATH_MAX, "%s/foobar", Path);
|
2004-09-13 20:21:26 +00:00
|
|
|
if (mkdirs(temp, 0775))
|
2001-11-25 12:18:18 +00:00
|
|
|
Syslog('+', "Created directory %s", Path);
|
|
|
|
}
|
|
|
|
|
|
|
|
free(temp);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-02 20:49:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Load Area Record
|
|
|
|
*/
|
|
|
|
int LoadAreaRec(int Area)
|
|
|
|
{
|
|
|
|
FILE *pAreas;
|
|
|
|
char *sAreas;
|
|
|
|
|
|
|
|
sAreas = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
2005-08-28 14:10:06 +00:00
|
|
|
snprintf(sAreas, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
2001-12-02 20:49:36 +00:00
|
|
|
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
|
|
|
WriteError("$Can't open %s", sAreas);
|
|
|
|
if (!do_quiet)
|
2003-11-15 12:31:05 +00:00
|
|
|
printf("\nCan't open %s\n", sAreas);
|
2001-12-02 20:49:36 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
|
|
|
if (fseek(pAreas, ((Area - 1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET)) {
|
|
|
|
WriteError("$Can't seek record %d in %s", Area, sAreas);
|
|
|
|
if (!do_quiet)
|
2003-11-15 12:31:05 +00:00
|
|
|
printf("\nCan't seek record %d in %s\n", Area, sAreas);
|
2001-12-02 20:49:36 +00:00
|
|
|
fclose(pAreas);
|
|
|
|
free(sAreas);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fread(&area, areahdr.recsize, 1, pAreas) != 1) {
|
|
|
|
WriteError("$Can't read record %d in %s", Area, sAreas);
|
|
|
|
if (!do_quiet)
|
2003-11-15 12:31:05 +00:00
|
|
|
printf("\nCan't read record %d in %s\n", Area, sAreas);
|
2001-12-02 20:49:36 +00:00
|
|
|
fclose(pAreas);
|
|
|
|
free(sAreas);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(pAreas);
|
|
|
|
free(sAreas);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-22 12:12:10 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|