mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-15 14:00:45 +01:00
+ Added option to delete executables, plus help and quiet
This commit is contained in:
parent
04d18a2964
commit
311e24fb75
@ -21,7 +21,7 @@
|
|||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
program Delp;
|
program Delp;
|
||||||
uses
|
uses
|
||||||
dos;
|
dos,getopts;
|
||||||
|
|
||||||
const
|
const
|
||||||
version='v1.00';
|
version='v1.00';
|
||||||
@ -158,6 +158,36 @@ begin
|
|||||||
until s='';
|
until s='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Var quiet: boolean;
|
||||||
|
|
||||||
|
procedure usage;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Writeln('Delp [options]');
|
||||||
|
Writeln('Where options is one of:');
|
||||||
|
writeln(' -e Delete executables also (Not on linux)');
|
||||||
|
writeln(' -h Displat (this) help message.');
|
||||||
|
writeln(' -q Be quiet.');
|
||||||
|
Halt(1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure processoptions;
|
||||||
|
|
||||||
|
Var c : char;
|
||||||
|
|
||||||
|
begin
|
||||||
|
quiet:=false;
|
||||||
|
Repeat
|
||||||
|
C:=Getopt('chq');
|
||||||
|
Case C of
|
||||||
|
'e' : AddMAsk('*.exe');
|
||||||
|
'h' : Usage;
|
||||||
|
'q' : Quiet:=True;
|
||||||
|
EndOfOptions : ;
|
||||||
|
end;
|
||||||
|
Until C=EndOfOptions;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
Dir : Searchrec;
|
Dir : Searchrec;
|
||||||
@ -165,16 +195,20 @@ var
|
|||||||
hp : pmaskitem;
|
hp : pmaskitem;
|
||||||
found : boolean;
|
found : boolean;
|
||||||
begin
|
begin
|
||||||
|
ProcessOptions;
|
||||||
AddMask('*.ppw *.ow *.aw *.sw');
|
AddMask('*.ppw *.ow *.aw *.sw');
|
||||||
AddMask('*.exe *.so *.dll');
|
AddMask('*.so *.dll');
|
||||||
AddMask('ppas.bat ppas.sh link.res fpcmaked fpcmade fpcmade.*');
|
AddMask('ppas.bat ppas.sh link.res fpcmaked fpcmade fpcmade.*');
|
||||||
AddMask('*.tpu *.tpp *.tpw *.tr');
|
AddMask('*.tpu *.tpp *.tpw *.tr');
|
||||||
AddMask('*.log *.bak');
|
AddMask('*.log *.bak');
|
||||||
AddMask('*.ppu *.o *.a *.s');
|
AddMask('*.ppu *.o *.a *.s');
|
||||||
AddMask('*.pp1 *.o1 *.a1 *.s1');
|
AddMask('*.pp1 *.o1 *.a1 *.s1');
|
||||||
AddMask('*.ppo *.oo *.ao *.so');
|
AddMask('*.ppo *.oo *.ao *.so');
|
||||||
|
if not quiet then
|
||||||
|
begin
|
||||||
WriteLn('DelPascal ',version,' (C) 1999 Peter Vreman');
|
WriteLn('DelPascal ',version,' (C) 1999 Peter Vreman');
|
||||||
Writeln;
|
Writeln;
|
||||||
|
end;
|
||||||
FindFirst('*.*',$20,Dir);
|
FindFirst('*.*',$20,Dir);
|
||||||
Total:=0;
|
Total:=0;
|
||||||
while (doserror=0) do
|
while (doserror=0) do
|
||||||
@ -200,12 +234,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
if hp^.Files>0 then
|
if hp^.Files>0 then
|
||||||
begin
|
begin
|
||||||
|
if not quiet then
|
||||||
WriteLn(' - Removed ',hp^.Files:2,' ',hp^.Mask,' (',DStr(hp^.Size)+' Bytes)');
|
WriteLn(' - Removed ',hp^.Files:2,' ',hp^.Mask,' (',DStr(hp^.Size)+' Bytes)');
|
||||||
inc(Total,hp^.Size);
|
inc(Total,hp^.Size);
|
||||||
found:=true;
|
found:=true;
|
||||||
end;
|
end;
|
||||||
hp:=hp^.next;
|
hp:=hp^.next;
|
||||||
end;
|
end;
|
||||||
|
if not quiet then
|
||||||
if not found then
|
if not found then
|
||||||
WriteLn(' - No Redundant Files Found!')
|
WriteLn(' - No Redundant Files Found!')
|
||||||
else
|
else
|
||||||
@ -213,7 +249,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2000-01-12 10:40:59 peter
|
Revision 1.6 2000-01-23 14:20:44 michael
|
||||||
|
+ Added option to delete executables, plus help and quiet
|
||||||
|
|
||||||
|
Revision 1.5 2000/01/12 10:40:59 peter
|
||||||
* fixed bug which sometimes matched .ppw with .pp
|
* fixed bug which sometimes matched .ppw with .pp
|
||||||
|
|
||||||
Revision 1.4 2000/01/07 16:46:02 daniel
|
Revision 1.4 2000/01/07 16:46:02 daniel
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user