home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
arc_lbr
/
chkpak.arc
/
CHKPAK.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-10-07
|
4KB
|
202 lines
(*
Program CHKPAK
Version 1.00
Author Atkinson - Home Computer - 414-543-8929 - 154/666
Language Turbo Pascal 4
Utilities Turbo Professional
Dos PC-DOS 3.3
Purpose To check integrity of archived files
Date 08/25/88
Disk One file is written - \CHKPAK.LOG
Note that \CHKPAK.LOG is not deleted by this program, it is
meant to be used at a later time by yourself.
If you have multiple directories you wish to check, the CHKPAK.LOG
file is not deleted. If it is present it is appended.
History 10/06/88 Created program
Usage: CHKPAK file
Where file is desired .ARC
Ex: *.*, *.ARC, A*.ARC AB*.ARC etc...
*)
{$B+}
{$D-}
{$F-}
{$I-}
{$L-}
{$M 16000,0,100000}
{$N-}
{$R-}
{$S-}
{$T-}
{$V+}
program chkpak;
uses dos, tpstring, tpdos, tpcrt, tpint;
const
inthandle = 15;
var
exitsave : pointer;
code,
loop : integer;
default_drive,
startdir,
arcname,
comment,
fullname : string;
ok : boolean;
errorfile,
arcsfound,
commentfile : text;
attr : word;
searchfor : searchrec;
procedure new1b(bp : word); interrupt;
var
regs : intregisters absolute bp;
begin
chainint(regs, isr_array[inthandle].origaddr);
halt;
end;
procedure findfirstarchive;
begin
attr := $3f;
findfirst(forceextension(paramstr(1),'ARC'), attr, searchfor);
ok := doserror = 0;
if ok
then
begin
writeln(arcsfound, fullpathname(searchfor.name));
end;
end;
procedure findrestarchive;
label 100;
begin
100: findnext(searchfor);
ok := doserror = 0;
if ok
then
begin
writeln(arcsfound, fullpathname(searchfor.name));
end;
if ok then goto 100;
end;
procedure logerror(name : string);
begin
writeln;
writeln('Logging error...', #7);
append(errorfile);
writeln(errorfile, 'ERROR IN FILE - ', name);
close(errorfile);
end;
procedure doarc;
begin
reset(arcsfound);
while not eof(arcsfound) do
begin
readln(arcsfound, arcname);
restorevector(inthandle);
code := execdos(fullname + ' /T '+arcname, false, Nil);
if initvector($1b, inthandle, @new1b) then {};
if dosexitcode <> 0 then logerror(arcname);
end;
close(arcsfound);
end;
procedure checkdos;
begin
if dosversion < $0300
then
begin
writeln;
writeln('DOS 3.++ or higher needed to operate...');
halt;
end;
end;
{$F+}
procedure end_program;
begin
erase(arcsfound);
writeln;
writeln('See \CHKPAK.LOG in your default drive root directory...');
chdir(default_drive);
chdir(startdir);
exitproc := exitsave;
end;
{$F-}
procedure setup;
begin
exitsave := exitproc;
exitproc := @end_program;
if initvector($1b, inthandle, @new1b) then {};
getdir(0, startdir);
default_drive := defaultdrive + ':\';
ok := false;
chdir(justpathname(paramstr(1)));
assign(arcsfound, '\arcstodo.$$$');
rewrite(arcsfound);
findfirstarchive;
end;
procedure main;
begin
if paramcount <> 0
then
if existonpath('pkxarc.exe', fullname)
or existonpath('pkunpak.exe', fullname)
then
begin
if ok
then
begin
findrestarchive;
close(arcsfound);
assign(errorfile, default_drive+'CHKPAK.LOG');
reset(errorfile);
if ioresult <> 0 then rewrite(errorfile);
close(errorfile);
doarc
end
else
begin
writeln;
writeln('No .ARC files to process...')
end
end
else
begin
writeln;
writeln('PKXARC or PKUNPAK not found on path...')
end
else
begin
writeln;
writeln('Usage:');
writeln;
writeln('CHKPAK file');
writeln;
writeln('Where file is desired .ARC');
writeln;
writeln('Ex: *.*, *.ARC, A*.ARC AB*.ARC etc...');
end;
end;
begin
setup;
main;
end.