home *** CD-ROM | disk | FTP | other *** search
- {*****************************************************************************
- * *
- * AL_Read.Pas By Andrew Farmer *
- * File Read and Write Module for AvaiList Revision 1.10 *
- * *
- * Copyright 1989 by Andrew D. Farmer, All Rights Reserved. *
- * *
- * *
- * Compiled using Turbo Pascal Version 5.0 By Borland International *
- * *
- *****************************************************************************}
-
- Procedure JulianDate (TheFlag : Word);
- Begin
- If TheFlag = 1 then JD := 0;
- If TheFlag = 2 then JD := 31;
- If TheFlag = 3 then JD := 59;
- If TheFlag = 4 then JD := 90;
- If TheFlag = 5 then JD := 120;
- If TheFlag = 6 then JD := 151;
- If TheFlag = 7 then JD := 181;
- If TheFlag = 8 then JD := 212;
- If TheFlag = 9 then JD := 243;
- If TheFlag = 10 then JD := 273;
- If TheFlag = 11 then JD := 304;
- If TheFlag = 12 then JD := 334;
- End;
-
- Procedure ReadDirBbs;
- Begin
- Assign(DirCopy,SortDir);
- {$I-} Reset(DirCopy); {$I+}
- OK := (IOResult = 0);
- If Not OK then Dirbbs := SortArea;
- If OK Then Begin Readln(DirCopy,DirBbs); Close(DirCopy); End;
- If Dirbbs = '' then Dirbbs := SortArea;
- For N := 1 to Length(Dirbbs) do
- Dirbbs[N] := UpCase(Dirbbs[N]);
- GraphLine := LR + LR + LR + LR;
- For N := 1 to Length(Dirbbs) do
- GraphLine := GraphLine + LR;
- Writeln(ListOut,'');
- WriteLn(ListOut,TL,Graphline,TR);
- Writeln(ListOut,TB,' ',dirbbs,' ',TB);
- Writeln(ListOut,BL,GraphLine,BR);
- If DoNewList = True then
- Begin
- Writeln(NewOut,'');
- WriteLn(NewOut,TL,Graphline,TR);
- Writeln(NewOut,TB,' ',dirbbs,' ',TB);
- Writeln(NewOut,BL,GraphLine,BR);
- End;
- End; { Procedure ReadDirBbs }
-
- Procedure ExpandFileSpec;
- Begin
- Date;
- count := 0;
- Fspace := ' ';
- FlagIt := ' ';
- TotalFile := TotalFile + 1;
- AreaTotal := AreaTotal + 1;
- TheFile := SearchData.Name;
- For N := 1 to length(TheFile) do
- Count := Count + 1;
- FCount := 12 - count;
- If FCount <> 0 then
- Begin
- For N := 1 to FCount do
- Fspace := FSpace + ' ';
- End;
- UnPackTime(SearchData.Time,SearchTime);
- TotalSize := TotalSize + SearchData.Size;
- AreaSize := AreaSize + SearchData.Size;
- If (FlagNew = True) then
- Begin
- If SearchTime.Year = Year then
- Begin
- JulianDate(month);
- NowJD := JD + day;
- JulianDate(SearchTime.Month);
- FileJD := JD + SearchTime.Day;
- DiffJD := NowJD - FileJD;
- If DiffJD < FlagDays then
- Begin
- FlagIt := FlagChar + ' ';
- TotalNFile := TotalNFile + 1;
- TotalNSize := TotalNSize + SearchData.Size;
- NewTot := NewTot + 1;
- End;
- End;
- If SearchTime.Year = Year - 1 then
- Begin
- JulianDate(month);
- NowJD := JD + day + 365;
- JulianDate(SearchTime.Month);
- FileJD := JD + SearchTime.Day;
- DiffJD := NowJD - FileJD;
- If DiffJD < FlagDays then
- Begin
- FlagIt := FlagChar + ' ';
- TotalNFile := TotalNFile + 1;
- TotalNSize := TotalNSize + SearchData.Size;
- NewTot := NewTot + 1;
- End;
- End;
- End;
- Str(SearchData.Size,FSize);
- Str(SearchTime.Year,FYear);
- Fyear := Copy(Fyear,3,2);
- Str(SearchTime.Month,FMonth);
- If FMonth = '0' then Fmonth := '00';
- If FMonth = '1' then Fmonth := '01';
- If FMonth = '2' then Fmonth := '02';
- If FMonth = '3' then Fmonth := '03';
- If FMonth = '4' then Fmonth := '04';
- If FMonth = '5' then Fmonth := '05';
- If FMonth = '6' then Fmonth := '06';
- If FMonth = '7' then Fmonth := '07';
- If FMonth = '8' then Fmonth := '08';
- If FMonth = '9' then Fmonth := '09';
- Str(SearchTime.Day,FDay);
- If FDay = '0' then FDay := '00';
- If FDay = '1' then FDay := '01';
- If FDay = '2' then FDay := '02';
- If FDay = '3' then FDay := '03';
- If FDay = '4' then FDay := '04';
- If FDay = '5' then FDay := '05';
- If FDay = '6' then FDay := '06';
- If FDay = '7' then FDay := '07';
- If FDay = '8' then FDay := '08';
- If FDay = '9' then FDay := '09';
- Fdate := Concat(Fmonth,'-',Fday,'-',Fyear);
- If NoDate = False then Writeln(ListOut,TheFile,FSpace,Fsize:7,' ',Fdate,FlagIt,TheDesc);
- If NoDate = True then Writeln(ListOut,TheFile,FSpace,Fsize:7,FlagIt,TheDesc);
- If (DoNewList = True) AND (FlagIt = FlagChar + ' ') then
- Begin
- If NoDate = False then Writeln(NewOut,TheFile,FSpace,Fsize:7,' ',Fdate,' ',TheDesc);
- If NoDate = True then Writeln(NewOut,TheFile,FSpace,Fsize:7,' ',TheDesc);
- End;
- End;
-
- Procedure ReadFilesBbs;
- Var Files : Array[1..512] of String[79];
- Label 1, Done;
- Begin
- Writeln(ListOut,'');
- If DoNewList = True then Writeln(NewOut,'');
- Assign(FileCopy,SortFiles);
- SetTextBuf(FileCopy,Buf);
- {$I-} Reset(FileCopy); {$I+}
- OK := (IOResult = 0);
- If Not OK then
- Begin
- Writeln(ListOut,'No Files');
- If DoNewList = True then Writeln(NewOut,'No Files');
- Exit;
- End;
- FileInc := 0;
- FileCount := 0;
- Repeat
- Inc(FileInc);
- ReadLn(FileCopy,GetFiles);
- Files[FileInc] := GetFiles;
- Until Eof(FileCopy);
- Close(FileCopy);
- FileCount := FileInc;
- FileInc := 0;
- Repeat
- Inc(FileInc);
- FilesBbs := Files[FileInc];
- FC1 := Copy(Filesbbs,1,1);
- FC2 := Copy(Filesbbs,1,13);
- if (Filesbbs = '') or (FC1 = ' ') or (FC1 = '-') then
- Begin
- If StripCom = False then Writeln(ListOut,Filesbbs);
- Goto 1;
- End;
- count := 0;
- repeat
- Count := Count + 1;
- Ch := Copy(FC2,Count,1);
- until (Ch = ' ') or (Count = Length(FilesBbs));
- If Count = Length(FilesBbs) then
- Begin
- Count := Length(Filesbbs);
- FileCheck := Copy(Filesbbs,1,count);
- TheDesc := 'No description given at upload';
- Goto Done;
- End;
- count := count - 1;
- FileCheck := Copy(Filesbbs,1,count);
- count2 := count + 2;
- FC3 := Copy(Filesbbs,count2,Length(Filesbbs));
- If FC3 = '' then TheDesc := 'No description given at upload';
- Count3 := 0;
- repeat
- Count3 := Count3 + 1;
- Ch := Copy(FC3,Count3,1);
- until Ch <> ' ';
- count3 := count3 + count2;
- count3 := count3 - 1;
- If NoDate = False then TheDesc := Copy(Filesbbs,count3,48);
- If NoDate = True then TheDesc := Copy(Filesbbs,count3,57);
- If TheDesc = '' then TheDesc := 'No description given at upload';
- Done:
- ThePath := SortArea + '\' + FileCheck;
- FindFirst(ThePath,AnyFile,SearchData);
- If (DOSERROR <> 0) AND (KillOrphan = False) then
- Begin
- TheFile := FileCheck;
- Count := 0;
- FSpace := ' ';
- For N := 1 to length(TheFile) do
- Count := Count + 1;
- FCount := 12 - count;
- If FCount <> 0 then
- Begin
- For N := 1 to FCount do
- Fspace := FSpace + ' ';
- End;
- If NoDate = True then
- Begin
- FSize := 'OFFLINE';
- Writeln(ListOut,TheFile,FSpace,Fsize:7,' ',TheDesc);
- End;
- If NoDate = False then
- Begin
- Fdate := 'OFF-LINE';
- FSize := ' STORED';
- Writeln(ListOut,TheFile,FSpace,Fsize:7,' ',Fdate,' ',TheDesc);
- End;
- End;
- If DOSERROR = 0 then
- Begin
- Repeat
- ExpandFileSpec;
- FindNext(SearchData);
- Until DOSERROR = 18;
- End;
- 1:
- Until FileInc = FileCount;
- End; { Procedure ReadFilesBbs }