-NOCHECK function and -FUPLOAD now imports FILE_ID.DIZ

This commit is contained in:
mysticbbs 2012-02-24 09:05:05 -05:00
parent d1ef461e43
commit de55cd9a03
1 changed files with 257 additions and 102 deletions

View File

@ -23,7 +23,8 @@ Program MBBSUTIL;
// post a text file to msg base? // post a text file to msg base?
// auto mass upload // auto mass upload
// import AREAS.BBS? // export AREAS.BBS?
// import FIDONET.NA
// .TIC stuff? // .TIC stuff?
{$I M_OPS.PAS} {$I M_OPS.PAS}
@ -41,38 +42,6 @@ Uses
{$I RECORDS.PAS} {$I RECORDS.PAS}
Type
JamLastType = Record
NameCrc : LongInt;
UserNum : LongInt;
LastRead : LongInt;
HighRead : LongInt;
End;
SquLastType = LongInt;
Function Rename_File (OldFN, NewFN: String) : Boolean;
Var
OldF : File;
Begin
Assign (OldF, NewFN);
{$I-} Erase (OldF); {$I+}
If IoResult = 0 Then;
Assign (OldF, OldFN);
{$I-} ReName (OldF, NewFN); {$I+}
Rename_File := (IoResult = 0);
End;
Function Exist (Str : String) : Boolean;
Begin
Exist := FSearch(Str, '') <> '';
End;
(***************************************************************************)
(***************************************************************************)
(***************************************************************************)
Const Const
FilePack : Boolean = False; FilePack : Boolean = False;
FileSort : Boolean = False; FileSort : Boolean = False;
@ -84,22 +53,105 @@ Const
UserKill : Boolean = False; UserKill : Boolean = False;
UserPack : Boolean = False; UserPack : Boolean = False;
MsgTrash : Boolean = False; MsgTrash : Boolean = False;
NodeCheck : Boolean = True;
UserKillDays : Integer = 0; UserKillDays : Integer = 0;
BBSSortID : String[8] = ''; BBSSortID : String = '';
BBSSortType : Byte = 0; BBSSortType : Byte = 0;
BBSKillID : String[8] = ''; BBSKillID : String = '';
BBSKillDays : Integer = 0; BBSKillDays : Integer = 0;
TrashFile : String = ''; TrashFile : String = '';
TempPath : String = '';
Var Var
ConfigFile : File of RecConfig; ConfigFile : File of RecConfig;
Config : RecConfig; Config : RecConfig;
Type
JamLastType = Record
NameCrc : LongInt;
UserNum : LongInt;
LastRead : LongInt;
HighRead : LongInt;
End;
SquLastType = LongInt;
Function ShellDOS (ExecPath: String; Command: String) : LongInt;
Begin
If ExecPath <> '' Then DirChange(ExecPath);
{$IFDEF UNIX}
Result := Shell (Command);
{$ENDIF}
{$IFDEF WINDOWS}
If Command <> '' Then Command := '/C' + Command;
Exec (GetEnv('COMSPEC'), Command);
Result := DosExitCode;
{$ENDIF}
DirChange(Config.SystemPath);
End;
Procedure ExecuteArchive (FName: String; Temp: String; Mask: String; Mode: Byte);
{mode: 1 = pack, 2 = unpack}
Var
A : Byte;
Temp2 : String[60];
ArcFile : File of RecArchive;
Arc : RecArchive;
Begin
Temp := JustFileExt(FName);
Reset (ArcFile);
Repeat
If Eof(ArcFile) Then Begin
Close (ArcFile);
Exit;
End;
Read (ArcFile, Arc);
If (Not Arc.Active) or (Arc.OSType <> OSType) Then Continue;
If Arc.Ext = Temp Then Break;
Until False;
Close (ArcFile);
Case Mode of
1 : Temp2 := Arc.Pack;
2 : Temp2 := Arc.Unpack;
End;
If Temp2 = '' Then Exit;
Temp := '';
A := 1;
While A <= Length(Temp2) Do Begin
If Temp2[A] = '%' Then Begin
Inc(A);
If Temp2[A] = '1' Then Temp := Temp + FName Else
If Temp2[A] = '2' Then Temp := Temp + Mask Else
If Temp2[A] = '3' Then Temp := Temp + TempPath;
End Else
Temp := Temp + Temp2[A];
Inc(A);
End;
ShellDOS ('', Temp);
End;
Procedure Update_Status (Str: String); Procedure Update_Status (Str: String);
Begin Begin
GotoXY (44, WhereY); GotoXY (44, WhereY);
Write (strPadR(Str, 35, ' ')); Write (strPadR(Str, 35, ' '));
End; End;
Procedure Update_Bar (Cur, Total: Integer); Procedure Update_Bar (Cur, Total: Integer);
@ -107,15 +159,16 @@ Var
Percent : Byte; Percent : Byte;
Begin Begin
Percent := Round(Cur / Total * 100 / 10); Percent := Round(Cur / Total * 100 / 10);
GotoXY (24, WhereY); GotoXY (24, WhereY);
Write (strRep(#178, Percent)); Write (strRep(#178, Percent));
Write (strRep(#176, 10 - Percent)); Write (strRep(#176, 10 - Percent));
Write (strPadL(strI2S(Percent * 10) + '%', 5, ' ')); Write (strPadL(strI2S(Percent * 10) + '%', 5, ' '));
End; End;
Procedure Show_Help; Procedure Show_Help;
Begin Begin
WriteLn ('Usage: MBBSUTIL.EXE <Options>'); WriteLn ('Usage: MBBSUTIL <Options>');
WriteLn; WriteLn;
WriteLn ('The following command line options are available:'); WriteLn ('The following command line options are available:');
WriteLn; WriteLn;
@ -125,11 +178,17 @@ Begin
WriteLn ('-FCHECK Checks file entries for correct size and status'); WriteLn ('-FCHECK Checks file entries for correct size and status');
WriteLn ('-FPACK Pack file bases'); WriteLn ('-FPACK Pack file bases');
WriteLn ('-FSORT Sort file base entries by filename'); WriteLn ('-FSORT Sort file base entries by filename');
WriteLn ('-FUPLOAD Mass upload all files into filebases');
WriteLn ('-MTRASH <File> Delete messages to/from users listed in <File>');
WriteLn ('-NOCHECK Bypass online user check at startup');
WriteLn ('-UKILL <Days> Delete users who have not called in <DAYS>'); WriteLn ('-UKILL <Days> Delete users who have not called in <DAYS>');
WriteLn ('-UPACK Pack user database'); WriteLn ('-UPACK Pack user database');
WriteLn ('-MTRASH <File> Delete messages to/from users listed in <File>');
End; End;
(***************************************************************************)
(***************************************************************************)
(***************************************************************************)
Procedure Sort_File_Bases; Procedure Sort_File_Bases;
Var Var
SortList : TQuickSort; SortList : TQuickSort;
@ -149,10 +208,10 @@ Begin
While Not Eof(FBaseFile) Do Begin While Not Eof(FBaseFile) Do Begin
Read (FBaseFile, FBase); Read (FBaseFile, FBase);
Update_Bar (FilePos(FBaseFile), FileSize(FBaseFile)); Update_Bar (FilePos(FBaseFile), FileSize(FBaseFile));
Update_Status (strStripMCI(FBase.Name)); Update_Status (strStripMCI(FBase.Name));
If ReName_File (Config.DataPath + FBase.FileName + '.dir', Config.DataPath + FBase.FileName + '.dib') Then Begin If FileRename (Config.DataPath + FBase.FileName + '.dir', Config.DataPath + FBase.FileName + '.dib') Then Begin
Assign (FDirFile, Config.DataPath + FBase.FileName + '.dib'); Assign (FDirFile, Config.DataPath + FBase.FileName + '.dib');
Reset (FDirFile); Reset (FDirFile);
@ -165,9 +224,9 @@ Begin
Read (FDirFile, FDir); Read (FDirFile, FDir);
If (FDir.Flags AND FDirDeleted = 0) Then If (FDir.Flags AND FDirDeleted = 0) Then
{$IFDEF FS_SENSITIVE} {$IFDEF FS_SENSITIVE}
SortList.Add(FDir.FileName, FilePos(FDirFile) - 1); SortList.Add(FDir.FileName, FilePos(FDirFile) - 1);
{$ELSE} {$ELSE}
SortList.Add(strUpper(FDir.FileName), FilePos(FDirFile) - 1); SortList.Add(strUpper(FDir.FileName), FilePos(FDirFile) - 1);
{$ENDIF} {$ENDIF}
End; End;
@ -186,44 +245,46 @@ Begin
Close (TFDirFile); Close (TFDirFile);
End; End;
End; End;
Close (FBaseFile); Close (FBaseFile);
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
Procedure Pack_File_Bases; Procedure Pack_File_Bases;
Var Var
A : Byte; A : Byte;
Temp : String[50]; Temp : String[50];
FDirFile : File of RecFileList; FDirFile : File of RecFileList;
TFDirFile : File of RecFileList; TFDirFile : File of RecFileList;
FDir : RecFileList; FDir : RecFileList;
DataFile : File; DataFile : File;
TDataFile : File; TDataFile : File;
FBaseFile : File of FBaseRec; FBaseFile : File of FBaseRec;
FBase : FBaseRec; FBase : FBaseRec;
Begin Begin
Write ('Packing File Bases : '); Write ('Packing File Bases : ');
Assign (FBaseFile, Config.DataPath + 'fbases.dat'); Assign (FBaseFile, Config.DataPath + 'fbases.dat');
{$I-} Reset (FBaseFile); {$I+} {$I-} Reset (FBaseFile); {$I+}
If IoResult <> 0 Then Exit; If IoResult <> 0 Then Exit;
While Not Eof(FBaseFile) Do Begin While Not Eof(FBaseFile) Do Begin
Read (FBaseFile, FBase); Read (FBaseFile, FBase);
Update_Bar (FilePos(FBaseFile), FileSize(FBaseFile)); Update_Bar (FilePos(FBaseFile), FileSize(FBaseFile));
Update_Status (strStripMCI(FBase.Name)); Update_Status (strStripPipe(FBase.Name));
If ReName_File (Config.DataPath + FBase.FileName + '.dir', Config.DataPath + FBase.FileName + '.dib') Then Begin If FileRename (Config.DataPath + FBase.FileName + '.dir', Config.DataPath + FBase.FileName + '.dib') Then Begin
Assign (FDirFile, Config.DataPath + FBase.FileName + '.dib'); Assign (FDirFile, Config.DataPath + FBase.FileName + '.dib');
Reset (FDirFile); Reset (FDirFile);
Assign (TFDirFile, Config.DataPath + FBase.FileName + '.dir'); Assign (TFDirFile, Config.DataPath + FBase.FileName + '.dir');
ReWrite (TFDirFile); ReWrite (TFDirFile);
If ReName_File (Config.DataPath + FBase.FileName + '.des', Config.DataPath + FBase.FileName + '.deb') Then Begin If FileRename (Config.DataPath + FBase.FileName + '.des', Config.DataPath + FBase.FileName + '.deb') Then Begin
Assign (TDataFile, Config.DataPath + FBase.FileName + '.deb'); Assign (TDataFile, Config.DataPath + FBase.FileName + '.deb');
Reset (TDataFile, 1); Reset (TDataFile, 1);
@ -250,18 +311,22 @@ Begin
End; End;
End; End;
Close (TDataFile); Close (TDataFile);
Erase (TDataFile); {delete backup file} Erase (TDataFile); {delete backup file}
Close (DataFile); Close (DataFile);
End; End;
Close (FDirFile); Close (FDirFile);
Erase (FDirFile); {delete backup file} Erase (FDirFile); {delete backup file}
Close (TFDirFile); Close (TFDirFile);
End; End;
End; End;
Close (FBaseFile); Close (FBaseFile);
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -278,15 +343,16 @@ Begin
Assign (FBaseFile, Config.DataPath + 'fbases.dat'); Assign (FBaseFile, Config.DataPath + 'fbases.dat');
{$I-} Reset (FBaseFile); {$I+} {$I-} Reset (FBaseFile); {$I+}
If IoResult <> 0 Then Exit; If IoResult <> 0 Then Exit;
While Not Eof(FBaseFile) Do Begin While Not Eof(FBaseFile) Do Begin
Read (FBaseFile, FBase); Read (FBaseFile, FBase);
Update_Bar (FilePos(FBaseFile), FileSize(FBaseFile)); Update_Bar (FilePos(FBaseFile), FileSize(FBaseFile));
Update_Status (strStripMCI(FBase.Name)); Update_Status (strStripPipe(FBase.Name));
If ReName_File (Config.DataPath + FBase.FileName + '.dir', Config.DataPath + FBase.FileName + '.dib') Then Begin If FileRename (Config.DataPath + FBase.FileName + '.dir', Config.DataPath + FBase.FileName + '.dib') Then Begin
Assign (FDirFile, Config.DataPath + FBase.FileName + '.dib'); Assign (FDirFile, Config.DataPath + FBase.FileName + '.dib');
Reset (FDirFile); Reset (FDirFile);
Assign (TFDirFile, Config.DataPath + FBase.FileName + '.dir'); Assign (TFDirFile, Config.DataPath + FBase.FileName + '.dir');
@ -294,6 +360,7 @@ Begin
While Not Eof(FDirFile) Do Begin While Not Eof(FDirFile) Do Begin
Read (FDirFile, FDir); Read (FDirFile, FDir);
If FDir.Flags And FDirDeleted = 0 Then Begin If FDir.Flags And FDirDeleted = 0 Then Begin
Assign (DF, FBase.Path + FDir.FileName); Assign (DF, FBase.Path + FDir.FileName);
{$I-} Reset (DF); {$I+} {$I-} Reset (DF); {$I+}
@ -309,17 +376,21 @@ Begin
Close (DF); Close (DF);
End; End;
Write (TFDirFile, FDir); Write (TFDirFile, FDir);
End; End;
End; End;
Close (FDirFile); {delete backup file} Close (FDirFile); {delete backup file}
Erase (FDirFile); Erase (FDirFile);
Close (TFDirFile); Close (TFDirFile);
End; End;
End; End;
Close (FBaseFile); Close (FBaseFile);
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -329,18 +400,19 @@ Var
BBSFile : File of BBSListRec; BBSFile : File of BBSListRec;
BBSList : BBSListRec; BBSList : BBSListRec;
Dir : SearchRec; Dir : SearchRec;
D : DirStr; D : DirStr;
N : NameStr; N : NameStr;
E : ExtStr; E : ExtStr;
Begin Begin
Write ('Packing BBS File :'); Write ('Packing BBS File :');
FindFirst (Config.DataPath + '*.bbi', AnyFile - Directory, Dir); FindFirst (Config.DataPath + '*.bbi', AnyFile - Directory, Dir);
While DosError = 0 Do Begin While DosError = 0 Do Begin
FSplit (Dir.Name, D, N, E); FSplit (Dir.Name, D, N, E);
If ReName_File (Config.DataPath + Dir.Name, Config.DataPath + N + '.bbz') Then Begin If FileRename (Config.DataPath + Dir.Name, Config.DataPath + N + '.bbz') Then Begin
Assign (TBBSFile, Config.DataPath + N + '.bbz'); Assign (TBBSFile, Config.DataPath + N + '.bbz');
Reset (TBBSFile); Reset (TBBSFile);
@ -353,7 +425,7 @@ Begin
If Not BBSList.Deleted Then Write (BBSFile, BBSList); If Not BBSList.Deleted Then Write (BBSFile, BBSList);
Update_Bar (FilePos(TBBSFile), FileSize(TBBSFile)); Update_Bar (FilePos(TBBSFile), FileSize(TBBSFile));
Update_Status (BBSList.BBSName); Update_Status (BBSList.BBSName);
End; End;
@ -383,7 +455,7 @@ Procedure Sort_BBS_List;
Str : String; Str : String;
A : Word; A : Word;
Begin Begin
If ReName_File (Config.DataPath + BBSSortID + '.bbi', Config.DataPath + BBSSortID + '.bbz') Then Begin If FileRename (Config.DataPath + BBSSortID + '.bbi', Config.DataPath + BBSSortID + '.bbz') Then Begin
Update_Status (BBSSortID); Update_Status (BBSSortID);
@ -438,6 +510,7 @@ Begin
If strUpper(BBSSortID) = 'ALL' Then Begin If strUpper(BBSSortID) = 'ALL' Then Begin
FindFirst (Config.DataPath + '*.bbi', AnyFile - Directory, Dir); FindFirst (Config.DataPath + '*.bbi', AnyFile - Directory, Dir);
While DosError = 0 Do Begin While DosError = 0 Do Begin
FSplit (Dir.Name, D, N, E); FSplit (Dir.Name, D, N, E);
BBSSortID := N; BBSSortID := N;
@ -450,6 +523,7 @@ Begin
SortList; SortList;
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -461,7 +535,7 @@ Procedure Kill_BBS_List;
BBSFile : File of BBSListRec; BBSFile : File of BBSListRec;
BBS : BBSListRec; BBS : BBSListRec;
Begin Begin
If ReName_File (Config.DataPath + BBSKillID + '.bbi', Config.DataPath + BBSKillID + '.bbb') Then Begin If FileRename (Config.DataPath + BBSKillID + '.bbi', Config.DataPath + BBSKillID + '.bbb') Then Begin
Assign (TBBSFile, Config.DataPath + BBSKillID + '.bbb'); Assign (TBBSFile, Config.DataPath + BBSKillID + '.bbb');
Reset (TBBSFile); Reset (TBBSFile);
@ -477,6 +551,7 @@ Procedure Kill_BBS_List;
If DaysAgo(BBS.Verified) >= BBSKillDays Then Begin If DaysAgo(BBS.Verified) >= BBSKillDays Then Begin
BBS.Deleted := True; BBS.Deleted := True;
BBSPack := True; BBSPack := True;
Update_Status ('Killing ' + BBS.BBSName); Update_Status ('Killing ' + BBS.BBSName);
End; End;
@ -499,10 +574,12 @@ Begin
If strUpper(BBSKillID) = 'ALL' Then Begin If strUpper(BBSKillID) = 'ALL' Then Begin
FindFirst (Config.DataPath + '*.bbi', AnyFile - Directory, Dir); FindFirst (Config.DataPath + '*.bbi', AnyFile - Directory, Dir);
While DosError = 0 Do Begin While DosError = 0 Do Begin
FSplit (Dir.Name, D, N, E); FSplit (Dir.Name, D, N, E);
BBSKillID := N; BBSKillID := N;
PackFile; PackFile;
FindNext(Dir); FindNext(Dir);
End; End;
@ -511,6 +588,7 @@ Begin
PackFile; PackFile;
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -522,7 +600,7 @@ Var
Begin Begin
Write ('Killing User File :'); Write ('Killing User File :');
If ReName_File (Config.DataPath + 'users.dat', Config.DataPath + 'users.dab') Then Begin If FileRename (Config.DataPath + 'users.dat', Config.DataPath + 'users.dab') Then Begin
Assign (TUserFile, Config.DataPath + 'users.dab'); Assign (TUserFile, Config.DataPath + 'users.dab');
Reset (TUserFile); Reset (TUserFile);
@ -543,12 +621,14 @@ Begin
Write (UserFile, User); Write (UserFile, User);
End; End;
Close (UserFile); Close (UserFile);
Close (tUserFile); Close (tUserFile);
Erase (tUserFile); Erase (tUserFile);
End; End;
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -576,7 +656,7 @@ Var
Begin Begin
Write ('Packing User File :'); Write ('Packing User File :');
If ReName_File (Config.DataPath + 'users.dat', Config.DataPath + 'users.dab') Then Begin If FileRename (Config.DataPath + 'users.dat', Config.DataPath + 'users.dab') Then Begin
Assign (TUserFile, Config.DataPath + 'users.dab'); Assign (TUserFile, Config.DataPath + 'users.dab');
Reset (TUserFile); Reset (TUserFile);
@ -651,7 +731,7 @@ Begin
0 : Begin 0 : Begin
{ DELETE JAM LASTREAD RECORDS } { DELETE JAM LASTREAD RECORDS }
If ReName_File (MBase.Path + MBase.FileName + '.jlr', MBase.Path + MBase.FileName + '.jlb') Then Begin If FileRename (MBase.Path + MBase.FileName + '.jlr', MBase.Path + MBase.FileName + '.jlb') Then Begin
Assign (TJamLRFile, MBase.Path + MBase.FileName + '.jlb'); Assign (TJamLRFile, MBase.Path + MBase.FileName + '.jlb');
Reset (TJamLRFile); Reset (TJamLRFile);
@ -690,6 +770,7 @@ Begin
Seek (SquLRFile, FileSize(SquLRFile) - 1); Seek (SquLRFile, FileSize(SquLRFile) - 1);
Truncate (SquLRFile); Truncate (SquLRFile);
End; End;
Close (SquLRFile); Close (SquLRFile);
End; End;
End; End;
@ -710,9 +791,11 @@ Begin
Seek (MScanFile, FileSize(MScanFile) - 1); Seek (MScanFile, FileSize(MScanFile) - 1);
Truncate (MScanFile); Truncate (MScanFile);
End; End;
Close (MScanFile); Close (MScanFile);
End; End;
End; End;
Close (MBaseFile); Close (MBaseFile);
End; End;
@ -725,6 +808,7 @@ Begin
Read (FBaseFile, FBase); Read (FBaseFile, FBase);
Assign (FScanFile, Config.DataPath + FBase.FileName + '.scn'); Assign (FScanFile, Config.DataPath + FBase.FileName + '.scn');
{$I-} Reset (FScanFile); {$I+} {$I-} Reset (FScanFile); {$I+}
If IoResult = 0 Then Begin If IoResult = 0 Then Begin
If FilePos(TUserFile) - 1 - Deleted <{=} FileSize(FScanFile) Then Begin If FilePos(TUserFile) - 1 - Deleted <{=} FileSize(FScanFile) Then Begin
For Count := FilePos(TUserFile) - 1 - Deleted to FileSize(FScanFile) - 2 Do Begin For Count := FilePos(TUserFile) - 1 - Deleted to FileSize(FScanFile) - 2 Do Begin
@ -733,12 +817,15 @@ Begin
Seek (FScanFile, Count); Seek (FScanFile, Count);
Write (FScanFile, FScan); Write (FScanFile, FScan);
End; End;
Seek (FScanFile, FileSize(FScanFile) - 1); Seek (FScanFile, FileSize(FScanFile) - 1);
Truncate (FScanFile); Truncate (FScanFile);
End; End;
Close (FScanFile); Close (FScanFile);
End; End;
End; End;
Close (FBaseFile); Close (FBaseFile);
End; End;
@ -752,6 +839,7 @@ Begin
End; End;
Update_Status ('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -824,6 +912,7 @@ Begin
Update_Bar(100, 100); Update_Bar(100, 100);
Update_Status('Completed'); Update_Status('Completed');
WriteLn; WriteLn;
End; End;
@ -834,12 +923,26 @@ Var
BaseFile : File of FBaseRec; BaseFile : File of FBaseRec;
ListFile : File of RecFileList; ListFile : File of RecFileList;
DescFile : File; DescFile : File;
DizFile : Text;
Base : FBaseRec; Base : FBaseRec;
List : RecFileList; List : RecFileList;
DirInfo : SearchRec; DirInfo : SearchRec;
Found : Boolean; Found : Boolean;
Desc : Array[1..99] of String[50]; Desc : Array[1..99] of String[50];
Count : Integer; Count : Integer;
Procedure RemoveDesc (Num: Byte);
Var
A : Byte;
Begin
For A := Num To List.DescLines - 1 Do
Desc[A] := Desc[A + 1];
Desc[List.DescLines] := '';
Dec (List.DescLines);
End;
Begin Begin
Write ('Mass Upload Files :'); Write ('Mass Upload Files :');
@ -898,10 +1001,38 @@ Begin
List.Downloads := 0; List.Downloads := 0;
List.Rating := 0; List.Rating := 0;
// IMPORT FILE_ID.DIZ here if not found then ExecuteArchive (Base.Path + List.FileName, '', 'file_id.diz', 2);
List.DescLines := 1; Assign (DizFile, TempPath + 'file_id.diz');
Desc[1] := NoDescStr; {$I-} Reset (DizFile); {$I+}
If IoResult = 0 Then Begin
List.DescLines := 0;
While Not Eof(DizFile) Do Begin
Inc (List.DescLines);
ReadLn (DizFile, Desc[List.DescLines]);
Desc[List.DescLines] := strStripLOW(Desc[List.DescLines]);
If Length(Desc[List.DescLines]) > mysMaxFileDescLen Then Desc[List.DescLines][0] := Chr(mysMaxFileDescLen);
If List.DescLines = Config.MaxFileDesc Then Break;
End;
Close (DizFile);
While (Desc[1] = '') and (List.DescLines > 0) Do
RemoveDesc(1);
While (Desc[List.DescLines] = '') And (List.DescLines > 0) Do
Dec (List.DescLines);
End Else Begin
List.DescLines := 1;
Desc[1] := NoDescStr;
End;
FileErase (TempPath + 'file_id.diz');
Assign (DescFile, Config.DataPath + Base.FileName + '.des'); Assign (DescFile, Config.DataPath + Base.FileName + '.des');
@ -933,8 +1064,8 @@ Begin
Close (BaseFile); Close (BaseFile);
End; End;
Update_Bar(100, 100); Update_Bar (100, 100);
Update_Status('Completed'); Update_Status ('Completed');
WriteLn; WriteLn;
End; End;
@ -946,6 +1077,7 @@ Var
Chat : ChatRec; Chat : ChatRec;
Begin Begin
TextAttr := 7; TextAttr := 7;
WriteLn; WriteLn;
WriteLn ('MBBSUTIL: ', mysSoftwareID, ' BBS Utilities Version ', mysVersion, ' (', OSID, ')'); WriteLn ('MBBSUTIL: ', mysSoftwareID, ' BBS Utilities Version ', mysVersion, ' (', OSID, ')');
WriteLn ('Copyright (C) 1997-2012 By James Coyle. All Rights Reserved.'); WriteLn ('Copyright (C) 1997-2012 By James Coyle. All Rights Reserved.');
@ -955,11 +1087,13 @@ Begin
Assign (ConfigFile, 'mystic.dat'); Assign (ConfigFile, 'mystic.dat');
{$I-} Reset(ConfigFile); {$I+} {$I-} Reset(ConfigFile); {$I+}
If IoResult <> 0 Then Begin If IoResult <> 0 Then Begin
WriteLn ('Error reading MYSTIC.DAT. Run MBBSUTIL from the main BBS directory.'); WriteLn ('Error reading MYSTIC.DAT. Run MBBSUTIL from the main BBS directory.');
Halt(1); Halt(1);
End; End;
Read (ConfigFile, Config);
Read (ConfigFile, Config);
Close (ConfigFile); Close (ConfigFile);
If Config.DataChanged <> mysDataChanged Then Begin If Config.DataChanged <> mysDataChanged Then Begin
@ -976,11 +1110,12 @@ Begin
While (A <= ParamCount) Do Begin While (A <= ParamCount) Do Begin
Temp := strUpper(ParamStr(A)); Temp := strUpper(ParamStr(A));
If Temp = '-BKILL' Then Begin If Temp = '-BKILL' Then Begin
BBSKillID := ParamStr(A+1); BBSKillID := ParamStr(A+1);
BBSKillDays := strS2I(ParamStr(A+2)); BBSKillDays := strS2I(ParamStr(A+2));
Inc(A, 2); Inc(A, 2);
If (strUpper(BBSKillID) <> 'ALL') And Not Exist(Config.DataPath + BBSKillID + '.bbi') Then Begin If (strUpper(BBSKillID) <> 'ALL') And Not FileExist(Config.DataPath + BBSKillID + '.bbi') Then Begin
WriteLn ('ERROR: -BKILL: List ID (' + BBSKillID + ') does not exist.'); WriteLn ('ERROR: -BKILL: List ID (' + BBSKillID + ') does not exist.');
Halt(1); Halt(1);
End Else End Else
@ -990,6 +1125,7 @@ Begin
End Else End Else
BBSKill := True; BBSKill := True;
End; End;
If Temp = '-BPACK' Then BBSPack := True; If Temp = '-BPACK' Then BBSPack := True;
If Temp = '-BSORT' Then Begin If Temp = '-BSORT' Then Begin
BBSSortID := ParamStr(A+1); BBSSortID := ParamStr(A+1);
@ -1013,7 +1149,7 @@ Begin
Halt(1); Halt(1);
End; End;
If (strUpper(BBSSortID) <> 'ALL') And Not Exist(Config.DataPath + BBSSortID + '.bbi') Then Begin If (strUpper(BBSSortID) <> 'ALL') And Not FileExist(Config.DataPath + BBSSortID + '.bbi') Then Begin
WriteLn ('ERROR: -BSORT: List ID (' + BBSSortID + ') does not exist.'); WriteLn ('ERROR: -BSORT: List ID (' + BBSSortID + ') does not exist.');
Halt(1); Halt(1);
End Else End Else
@ -1025,8 +1161,11 @@ Begin
If Temp = '-FUPLOAD' Then FileUpload := True; If Temp = '-FUPLOAD' Then FileUpload := True;
If Temp = '-UKILL' Then Begin If Temp = '-UKILL' Then Begin
UserKill := True; UserKill := True;
Inc(A); Inc(A);
UserKillDays := strS2I(ParamStr(A)); UserKillDays := strS2I(ParamStr(A));
If UserKillDays < 5 Then Begin If UserKillDays < 5 Then Begin
WriteLn ('ERROR: -UKILL days must be set to at LEAST 5.'); WriteLn ('ERROR: -UKILL days must be set to at LEAST 5.');
Halt(1); Halt(1);
@ -1038,7 +1177,7 @@ Begin
MsgTrash := True; MsgTrash := True;
TrashFile := strStripB(ParamStr(A), ' '); TrashFile := strStripB(ParamStr(A), ' ');
If (TrashFile <> '') And Not Exist(TrashFile) Then Begin If (TrashFile <> '') And Not FileExist(TrashFile) Then Begin
WriteLn('ERROR: Trash file does not exist.'); WriteLn('ERROR: Trash file does not exist.');
Halt(1); Halt(1);
End; End;
@ -1050,25 +1189,41 @@ Begin
Inc (A); Inc (A);
End; End;
For A := 1 to Config.INetTNNodes Do Begin If NodeCheck Then
Assign (ChatFile, Config.DataPath + 'chat' + strI2S(A) + '.dat'); For A := 1 to Config.INetTNNodes Do Begin
{$I-} Reset (ChatFile); {$I+} Assign (ChatFile, Config.DataPath + 'chat' + strI2S(A) + '.dat');
If IoResult = 0 Then Begin {$I-} Reset (ChatFile); {$I+}
Read (ChatFile, Chat);
If Chat.Active Then Begin If IoResult = 0 Then Begin
WriteLn ('ERROR: MBBSUTIL has detected that a user is online at this time.'); Read (ChatFile, Chat);
WriteLn (' In order to prevent corruption of the system data files,');
WriteLn (' this program should only be ran when there are NO users'); If Chat.Active Then Begin
WriteLn (' logged in to the BBS system.'); WriteLn ('ERROR: MBBSUTIL has detected that a user is online at this time.');
WriteLn (''); WriteLn (' In order to prevent corruption of the system data files,');
WriteLn ('Create a system event to log off all users before running this program.'); WriteLn (' this program should only be ran when there are NO users');
WriteLn ('If there are NO users online and MBBSUTIL detects that there are, try'); WriteLn (' logged in to the BBS system.');
WriteLn ('changing to the data directory, typing "DEL CHAT*.DAT" then re-run'); WriteLn ('');
WriteLn ('MBBSUTIL'); WriteLn ('Create a system event to log off all users before running this program.');
Halt(1); WriteLn;
WriteLn ('If there are NO users online and MBBSUTIL detects that there are, try');
WriteLn ('changing to the data directory and deleting "chat*.dat" then re-run');
WriteLn ('MBBSUTIL');
WriteLn;
WriteLn ('Using the -NOCHECK option will bypass this check');
Halt(1);
End;
End; End;
End; End;
End;
{$I-}
MkDir (Config.SystemPath + 'temp0');
If IoResult <> 0 Then;
{$I+}
TempPath := Config.SystemPath + 'temp0' + PathChar;
DirClean (TempPath, '');
If FileUpload Then Upload_File_Bases; If FileUpload Then Upload_File_Bases;
If FileSort Then Sort_File_Bases; If FileSort Then Sort_File_Bases;