home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
PARADIS1
/
ARJVIEW.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-02-25
|
5KB
|
153 lines
(7189) Sat 22 Feb 92 13:43
By: Steve Gabrilowitz
To: Darren Lyon
Re: Re: Arj viewing
St:
---------------------------------------------------------------------------
@PID: QE 2.76 (Beta-5)
@MSGID: 1:363/1701 29A10D6B
In a message to Steve Gabrilowitz <02-20-92 00:33> Darren Lyon wrote:
DL> Steve Gabrilowitz of [1:363/1701] once typed in a message to someone:
DL>
DL> SG> Are you looking for something that will extract and display text
DL> files
DL> SG> from the ARJ, or just a program to read the header and display
DL> the
DL> SG> directory? I have the latter...
DL>
DL> Does it write out a display similar to that of the ARJ L ***.ARJ
DL> command?
DL> Well not the same, but accesses all the information? If so, can you
DL> post it
DL> here??
A bit ugly, but here it is:
Program ListARJ;
Uses OpString;
Type
ARJsignature=Record
MagicNumber : Word;
BasicHdrSiz : Word;
End;
ARJheader=record
FirstHdrSize: Byte; (* size up to extra data *)
ARJversion : Byte; (* version that created archive *)
ARJrequired : Byte; (* oldest possible to unextract *)
HostOS : Byte;
Flags : Byte;
Method : Byte; (* 0=stored, or comp level 1-4 *)
FileType : Byte; (* 0=binary, 1=text, 2=comment header *)
GarbleMod : Byte; (* Garbled password modifier? *)
DateTime : LongInt;
CompSize : LongInt;
OrigSize : LongInt;
OrigCRC : Array[1..4] of Byte;
EntryName : Word; (* entryname position in filename? *)
AccessMode : Word;
HostData : Word;
End;
Var
ArjFile : File;
Hdr : ARJheader;
Sig : ARJsignature;
FileName : String;
MethodStr: String;
JunkByte : Byte;
BytesRead : Word;
I : Integer;
HeaderCRC : LongInt;
ExtSize : Word;
TimeStr : String[5];
DateStr : String[8];
Month,Day,Year,Hour,Minute : Word;
Ratio : Word;
function int_str(Num,Len : Word) : String;
Var
Answer : String[5];
Begin
Answer:=Long2Str(Num);
While Length(Answer)<Len Do Answer:='0'+Answer;
Int_Str:=Answer;
End;
Begin
Write('ARJ file: '); Readln(FileName);
Assign(ArjFile,FileName);
Reset(ArjFile,1);
BlockRead(ArjFile,Sig,SizeOf(Sig));
BlockRead(ArjFile,Hdr,SizeOf(Hdr),BytesRead);
I:=0;
Repeat
Inc(I);
BlockRead(ArjFile,FileName[I],1);
Until FileName[I]=#0;
FileName[0]:=Chr(I-1);
Repeat
BlockRead(ArjFile,JunkByte,1);
Until JunkByte=0; (* Blow off the comment *)
BlockRead(ArjFile,HeaderCRC,4);
BlockRead(ArjFile,ExtSize,2);
If ExtSize>0 Then Seek(ArjFile,FilePos(ArjFile)+ExtSize+4);
BlockRead(ArjFile,Sig,SizeOf(Sig));
Writeln('Filename Length Method Size Now Ratio Date Time
CRC');
Writeln('------------ -------- -------- -------- ----- --------- -----
--------');
While Sig.BasicHdrSiz>0 Do
Begin
BlockRead(ArjFile,Hdr,SizeOf(Hdr),BytesRead);
I:=0;
Repeat
Inc(I);
BlockRead(ArjFile,FileName[I],1);
Until FileName[I]=#0;
FileName[0]:=Chr(I-1);
Repeat
BlockRead(ArjFile,JunkByte,1);
Until JunkByte=0; (* Blow off the comment *)
Case Hdr.Method Of
0 : MethodStr := ' Stored ';
1 : MethodStr := 'Factor-1';
2 : MethodStr := 'Factor-2';
3 : MethodStr := 'Factor-3';
4 : MethodStr := 'Factor-4';
Else
MethodStr := 'Unknown ';
End;
if (Hdr.CompSize < 1) or (Hdr.OrigSize < 1) then
Ratio := 0
else
Ratio := (100*(Hdr.OrigSize-Hdr.CompSize) div Hdr.OrigSize);
Month:=(Hdr.DateTime shr 21) and $0F;
Day:=(Hdr.DateTime shr 16) and $1F;
Year:=((Hdr.DateTime shr 25) and $7F)+80;
Hour:=(Hdr.DateTime shr 11) and $1F;
Minute:=(Hdr.DateTime shr 5) and $3F;
TimeStr := int_str(Hour, 2)+':'+int_str(Minute, 2);
DateStr := int_str(Month, 2)+'-'+int_str(Day, 2)+'-'+int_str(Year, 2);
Writeln(Pad(FileName,12)+' '+
Pad(Long2Str(Hdr.OrigSize),8)+' '+
MethodStr+' '+
Pad(Long2Str(Hdr.CompSize),8)+' '+
Pad(Long2Str(Ratio)+'%', 5)+' '+
DateStr+' '+
TimeStr+' '+
HexB(Hdr.OrigCRC[4])+
HexB(Hdr.OrigCRC[3])+
HexB(Hdr.OrigCRC[2])+
HexB(Hdr.OrigCRC[1]));
BlockRead(ArjFile,HeaderCRC,4);
BlockRead(ArjFile,ExtSize,2);
Seek(ArjFile,FilePos(ArjFile)+Hdr.CompSize);
BlockRead(ArjFile,Sig,SizeOf(Sig));
End;
End.
--- QuickBBS 2.76 (Beta-5)
* Origin: NCC-1701 - Orlando, FL Warp 9.6 HST (407) 380-1701 (1:363/1701)
@PATH: 363/1701 320 151/1003 13/13 396/1 170/400 512/0 1007