summaryrefslogtreecommitdiff
path: root/tools.pas
diff options
context:
space:
mode:
Diffstat (limited to 'tools.pas')
-rw-r--r--tools.pas47
1 files changed, 26 insertions, 21 deletions
diff --git a/tools.pas b/tools.pas
index f07b4c4..e07be8b 100644
--- a/tools.pas
+++ b/tools.pas
@@ -9,10 +9,10 @@ uses
type
tAktualitaet = (aNichtVorhanden,aVeraltet,aAktuell,aWirdErneuert);
- tStringlistBArray = array[boolean] of tStringlist;
+ tMyStringlistBArray = array[boolean] of tMyStringlist;
tSummenDatei = record
name: string;
- inhalt: tStringlistBArray;
+ inhalt: tMyStringlistBArray;
end;
tDateiMitDatum = class
name: ansiString;
@@ -38,16 +38,16 @@ function max(a1,a2: tAktualitaet): tAktualitaet; inline; overload;
function anzCs(c: char; s: string): longint;
function notQuotedPos(was,worin: string): longint;
function unescapedpos(was,worin: string): longint;
-procedure testeObBefehlLokal(bef, ordner: string; lokTest: tRegExpr);
-function extrahiereAlleDateien(woraus: string): tMyStringList;
+procedure testeObBefehlLokal(bef, ordner: string; dateiListe: tMyStringList; lokTest: tRegExpr);
+function extrahiereAlleDateien(woraus: string; dateiListe: tMyStringList): tMyStringList;
function unescape(s: string): string;
function escape(s,toe: string; ec: char): string;
procedure ersetzeAlleVorkommen(var worin: string; was,wodurch: string);
// Routinen für sha512-Prüfsummen
-function testeSummen(sumNam: string): tStringlistBArray;
-function dateienMitGueltigerSumme(sumNam: string): tStringList;
+function testeSummen(sumNam: string): tMyStringlistBArray;
+function dateienMitGueltigerSumme(sumNam: string): tMyStringList;
implementation
@@ -187,25 +187,25 @@ begin
result:=0;
end;
-procedure testeObBefehlLokal(bef, ordner: string; lokTest: tRegExpr);
+procedure testeObBefehlLokal(bef, ordner: string; dateiListe: tMyStringList; lokTest: tRegExpr);
var
exe,args,regex,oBef,s: string;
dateien,sl,relZeil: tMyStringlist;
i,matchNum: longint;
re: tRegExpr;
begin
- oBef:=bef;
-
+ bef:=trim(bef);
while notQuotedPos(';',bef)>0 do begin
- testeObBefehlLokal(trim(leftStr(bef,notQuotedPos(';',bef)-1)),ordner,lokTest);
+ testeObBefehlLokal(trim(leftStr(bef,notQuotedPos(';',bef)-1)),ordner,dateiListe,lokTest);
delete(bef,1,notQuotedPos(';',bef));
bef:=trim(bef);
end;
while notQuotedPos('&&',bef)>0 do begin
- testeObBefehlLokal(trim(leftStr(bef,notQuotedPos('&&',bef)-1)),ordner,lokTest);
+ testeObBefehlLokal(trim(leftStr(bef,notQuotedPos('&&',bef)-1)),ordner,dateiListe,lokTest);
delete(bef,1,notQuotedPos('&&',bef)+1);
bef:=trim(bef);
end;
+ oBef:=bef;
args:='';
repeat
@@ -215,8 +215,13 @@ begin
args:=args+' '+trim(leftStr(bef,notQuotedPos('|',bef)-1));
delete(bef,1,notQuotedPos('|',bef));
end;
+ if notQuotedPos('=',exe)<>0 then begin
+ args:=args+' '+trim(copy(exe,notQuotedPos('=',exe)+1,length(exe)));
+ delete(bef,1,length(exe));
+ bef:=trim(bef);
+ end;
bef:=trim(bef);
- until (notQuotedPos('=',bef)=0) and (exe<>'do') and (exe<>'cat');
+ until (notQuotedPos('=',exe)=0) and (exe<>'do') and (exe<>'cat');
delete(args,1,1);
exe:=extractfilename(exe);
@@ -264,7 +269,7 @@ begin
matchNum:=0;
end;
- dateien:=extrahiereAlleDateien(args+' '+bef);
+ dateien:=extrahiereAlleDateien(args+' '+bef,dateiListe);
if dateien.count = 0 then
gibAus('Warnung: Hier ist ein Befehl ohne offensichtliche Input-Dateien! ('''+oBef+''')!',3);
@@ -310,7 +315,7 @@ begin
relZeil.free;
end;
-function extrahiereAlleDateien(woraus: string): tMyStringList;
+function extrahiereAlleDateien(woraus: string; dateiListe: tMyStringList): tMyStringList;
var
s: string;
begin
@@ -320,7 +325,7 @@ begin
s:=leftStr(woraus,notQuotedPos(' ',woraus));
delete(woraus,1,length(s));
s:=trim(s);
- if fileexists(s) then
+ if fileexists(s) or dateiListe.hatZeile(s,false) then
result.add(s);
end;
end;
@@ -362,7 +367,7 @@ end;
var
summenvorrat: array of tSummenDatei;
-function testeSummen(sumNam: string): tStringlistBArray;
+function testeSummen(sumNam: string): tMyStringlistBArray;
var
p: tProcess;
rb,i: longint;
@@ -374,7 +379,7 @@ begin
for i:=0 to length(summenvorrat)-1 do
if summenvorrat[i].name=sumNam then begin
for gut:=false to true do begin
- result[gut]:=tStringlist.create;
+ result[gut]:=tMyStringlist.create;
result[gut].text:=summenvorrat[i].inhalt[gut].text;
end;
exit;
@@ -405,7 +410,7 @@ begin
erg.text:=s;
s:='';
for gut:=false to true do begin
- result[gut]:=tStringlist.create;
+ result[gut]:=tMyStringlist.create;
rb:=0;
for i:=0 to erg.count-1 do
if not gut xor (rightStr(erg[i],4)=': OK') then begin
@@ -422,15 +427,15 @@ begin
with summenvorrat[length(summenvorrat)-1] do begin
name:=sumNam;
for gut:=false to true do begin
- inhalt[gut]:=tStringlist.create;
+ inhalt[gut]:=tMyStringlist.create;
inhalt[gut].text:=result[gut].text;
end;
end;
end;
-function dateienMitGueltigerSumme(sumNam: string): tStringList;
+function dateienMitGueltigerSumme(sumNam: string): tMyStringList;
var
- sums: tStringlistBArray;
+ sums: tMyStringlistBArray;
begin
sums:=testeSummen(sumNam);
result:=sums[true];