CVS freexp
CVS User mw
cvs-list at freexp.de
Son Sep 24 11:20:53 CEST 2006
Update of /server/cvs/freexp
In directory m25s18:/tmp/cvs-serv12996
Modified Files:
Tag: Branch_3_40_Release
touch.inc touch.pas
Added Files:
Tag: Branch_3_40_Release
dtdiff.pas touch0.pas touch1.pas
Log Message:
MW: - Update auf Touch 1.3.1
--- /server/cvs/freexp/touch.inc 2006/04/20 08:06:33 1.4.2.2
+++ /server/cvs/freexp/touch.inc 2006/09/24 09:20:53 1.4.2.3
@@ -1,6 +1,6 @@
{ --------------------------------------------------------------- }
{ Dieser Quelltext ist urheberrechtlich geschuetzt. }
-{ (c) 2004-2006 Martin Wodrich, http://www.martinwodrich.de }
+{ (c) 2003-2006 Martin Wodrich, http://www.martinwodrich.de }
{ software at martinwodrich.de }
{ }
{ Dieser Quelltext ist Freeware. }
@@ -9,10 +9,13 @@
{ finden Sie in der Datei TOUCH.TXT oder auf }
{ http://www.martinwodrich.de/Software/Touch/nutzung.htm }
{ --------------------------------------------------------------- }
-{ $Id: touch.inc,v 1.4.2.2 2006/04/20 08:06:33 mw Exp $ }
+{ $Id: touch.inc,v 1.4.2.3 2006/09/24 09:20:53 mw Exp $ }
{ Erstmal einiges definieren }
+{ Nur GPL-Module benutzen? }
+{DEFINE GPLONLY}
+
{ FreeXP-Setting}
{$DEFINE freexp}
@@ -46,9 +49,11 @@
{$ENDIF }
{ Andere Compiler brauchen momentan keine Extras }
-
{
$Log: touch.inc,v $
+ Revision 1.4.2.3 2006/09/24 09:20:53 mw
+ MW: - Update auf Touch 1.3.1
+
Revision 1.4.2.2 2006/04/20 08:06:33 mw
MW: - Update auf Touch 1.2.4
--- /server/cvs/freexp/touch.pas 2006/09/02 16:00:12 1.22.2.7
+++ /server/cvs/freexp/touch.pas 2006/09/24 09:20:53 1.22.2.8
@@ -9,7 +9,7 @@
{ finden Sie in der Datei TOUCH.TXT oder auf }
{ http://www.martinwodrich.de/Software/Touch/nutzung.htm }
{ --------------------------------------------------------------- }
-{ $Id: touch.pas,v 1.22.2.7 2006/09/02 16:00:12 mw Exp $ }
+{ $Id: touch.pas,v 1.22.2.8 2006/09/24 09:20:53 mw Exp $ }
{$IFDEF MSDOS}{$M 32768,131072,655360}{$ENDIF}
program touch;
{$I TOUCH.INC }
@@ -17,71 +17,21 @@
{ Betriebsystemabhaeniges }
{$IFNDEF WINDOWS }
{$IFDEF VPOS2}
-uses use32,dos,crt,md5{$IFNDEF freexp},freexp{$ELSE},fileio{$ENDIF};
+uses use32,dos,crt,touch0,touch1,dtdiff
+ {$IFNDEF GPLONLY},md5
+ {$IFNDEF freexp},freexp{$ELSE},fileio{$ENDIF}{$ENDIF};
{$ELSE }
-uses dos,crt{$IFDEF BPLFN},touchlfn{$ENDIF},md5{$IFNDEF freexp},freexp{$ELSE},fileio{$ENDIF};
+uses dos,crt{$IFDEF BPLFN},touchlfn{$ENDIF},touch0,touch1,dtdiff
+ {$IFNDEF GPLONLY},md5
+ {$IFNDEF freexp},freexp{$ELSE},fileio{$ENDIF}{$ENDIF}
+ {$IFDEF unix},sysutils{$ENDIF};
{$ENDIF }
{$ELSE }
-uses windos,wincrt,strings,md5{$IFNDEF freexp},freexp{$ELSE},fileio{$ENDIF};
+uses windos,wincrt,strings,touch0,touch1,dtdiff
+ {$IFNDEF GPLONLY},md5
+ {$IFNDEF freexp},freexp{$ELSE},fileio{$ENDIF}{$ENDIF};
{$ENDIF }
-const anyfile=$21;
- {$IFNDEF DPMI}
- {$IFNDEF unix}
- beta='.5'; {Patchlevel 5}
- {$ELSE}
- !!! Touch 1.2 läuft nicht auf unixartigen Betriebsystemen !!
- beta=' Alpha 7';
- {$ENDIF}
- {$ELSE}
- beta=' Alpha 7';
- {$ENDIF}
- version='1.2'+beta;
- touchname='Touch '+version;
- copyright=' (c) 2003-2006 by Martin Wodrich';
-
- { Betriebsystemstrings }
- {$IFDEF MSDOS}
- {$IFDEF BPLFN}
- pform = ' (DOS16,LFN)';
- {$ELSE}
- pform = ' (DOS16,NON LFN)';
- {$ENDIF}
- {$ENDIF}
- {$IFDEF DPMI}
- pform = ' (DPMI16)';
- {$ENDIF}
- {$IFDEF WINDOWS}
- pform = ' (WIN16)';
- {$ENDIF}
- {$IFDEF Dos32}
- pform = ' (DOS32)';
- {$ENDIF}
- {$IFDEF Win32}
- pform = ' (WIN32)';
- {$ENDIF}
- {$IFDEF Linux}
- pform = ' (Linux)';
- {$ENDIF}
- {$IFDEF OS2}
- {$IFDEF BP}
- pform = ' (OS2,16 Bit)';
- {$ELSE}
- pform = ' (OS2,EMX)';
- {$ENDIF}
- {$ENDIF}
-
- { Betriebsystemabhängiges }
- {$IFNDEF unix}
- OSDirSeparator = '\';
- Paramark = '/';
- CR='';
- {$ELSE}
- OSDirSeparator = '/';
- Paramark = '-';
- CR=#13;
- {$ENDIF}
-
type
macrop = ^macro;
macro = record
@@ -92,6 +42,9 @@
var f:file;
g:text;
md5f:text;
+{$IFDEF unix}
+ ha:longint;
+{$ENDIF}
{$IFDEF WINDOWS }
dt : TDateTime;
DirInfo : TSearchRec;
@@ -116,7 +69,9 @@
h,mi,se,hund: Word;
y,mo,d,dw : Word;
ftime : Longint;
- ref : boolean;
+ ref,rel : boolean;
+ rel1,rel2 : boolean;
+ dire : boolean;
s,u : string[100];
sim,zcout : boolean;
md5b : boolean;
@@ -167,7 +122,7 @@
begin
writeln ('Parameter fehlt'+CR);
writeln (''+CR);
- writeln ('touch file1 file2 ... '+Paramark+'T=hh:mm:ss '+Paramark+'D=tt.mm.[yy]yy '+
+ writeln ('touch file1 file2 ... '+Paramark+'T=[+/-]hh:mm:ss '+Paramark+'D=[+/-]tt.mm.[yy]yy '+
Paramark+'R=refdatei '+Paramark+'H '+Paramark+'S '+Paramark+'V '+
Paramark+'G '+Paramark+'K'+CR);
write (' ');
@@ -217,7 +172,9 @@
writeln (' '+Paramark+'J=Jobfile Dateiliste verwenden, statt lange Argumentliste'+CR);
writeln (' '+Paramark+'ZC Neue Dateien als ZConnect-PUFFER erstellen'+CR);
writeln (' '+Paramark+'I Interaktiver Modus (Lesen der Dateiinfos von Standard-Input)'+CR);
+ {$IFNDEF GPLONLY}
writeln (' '+Paramark+'MD5 Pruefsummendatei md5sums mit MD5-Summen erstellen'+CR);
+ {$ENDIF}
end;
procedure isok(meldung:integer);
@@ -306,7 +263,7 @@
Findfirst(sp,$10,DirInfo);
{$ELSE}
{$IFNDEF BPLFN}
- Findfirst(x,$10,DirInfo);
+ dos.Findfirst(x,$10,DirInfo);
{$ELSE}
touchlfn.Findfirst(x,$10,DirInfo);
{$ENDIF}
@@ -320,7 +277,11 @@
NewEntry;
end;
{$IFNDEF BPLFN}
+ {$IFNDEF Windows}
+ dos.FindNext(DirInfo);
+ {$ELSE}
FindNext(DirInfo);
+ {$ENDIF}
{$ELSE}
touchlfn.FindNext(DirInfo);
{$ENDIF}
@@ -338,7 +299,7 @@
Findfirst(sp,$10,DirInfo);
{$ELSE }
{$IFNDEF BPLFN}
- Findfirst(x,$10,DirInfo);
+ dos.Findfirst(x,$10,DirInfo);
{$ELSE}
touchlfn.Findfirst(x,$10,DirInfo);
{$ENDIF}
@@ -352,7 +313,11 @@
NewEntry;
end;
{$IFNDEF BPLFN}
+ {$IFNDEF Windows}
+ dos.FindNext(DirInfo);
+ {$ELSE}
FindNext(DirInfo);
+ {$ENDIF}
{$ELSE}
touchlfn.FindNext(DirInfo);
{$ENDIF}
@@ -387,7 +352,11 @@
{nur timeset date aus Datei}
{nichts testtime:=ftime}
if not (dateset xor timeset) then testtime:=ftime else begin
+ {$IFNDEF unix}
GetFTime(f,foldtime);
+ {$ELSE}
+ foldtime:=FileAge(fname);
+ {$ENDIF}
UnpackTime(foldtime,dt2);
if dateset then begin
{zeitangaben von dt2 nach dt kopieren}
@@ -434,7 +403,7 @@
procedure init_touch;
begin
- files:=anyfile;
+ files:=anyfile;
st:=nil;
n:=nil;
dateSet:=false;
@@ -448,6 +417,10 @@
nc:=false;
{$ENDIF}
md5b:=false;
+ rel:=false;
+ rel1:=false;
+ rel2:=false;
+ dire:=false;
end;
{$IFDEF BPLFN}
@@ -514,6 +487,87 @@
{$ENDIF}
end;
+ procedure datetimepar;
+ begin
+ if (copy(s,2,2)='T=') then begin
+ {Uhrzeit lesen}
+ {/t=hh:mm:ss}
+ if Copy(s,4,1)='+' then begin
+ rel:=true;
+ dire:=true;
+ rel1:=true;
+ end;
+ if Copy(s,4,1)='-' then begin
+ rel:=true;
+ dire:=false;
+ rel1:=true;
+ end;
+ if (rel and not rel2) then begin
+ d:=0;
+ mo:=0;
+ y:=0;
+ end;
+ if rel=true then u:=Copy(s,5,255)
+ else u:=Copy(s,4,255);
+ s:=u;
+ val(copy(s,0,(pos(':',s)-1)),h,t);
+ isok(2);
+ s:=Copy(s,(pos(':',s)+1),255);
+ val(copy(s,0,(pos(':',s)-1)),mi,t);
+ isok(2);
+ s:=Copy(s,(pos(':',s)+1),255);
+ val(s,se,t);
+ isok(2);
+ if not rel then
+ if (((h<0) or (h>23)) or ((mi<0) or (mi>59)) or ((se<0) or (se>59))) then begin
+ writeln('Zeitangabe ungueltig'+CR);
+ halt(1);
+ end;
+ timeSet:=true;
+ end;
+
+ if (copy(s,2,2)='D=') then begin
+ {Datum lesen}
+ {/d=tt.mm.yy}
+ if Copy(s,4,1)='+' then begin
+ rel:=true;
+ dire:=true;
+ rel2:=true;
+ end;
+ if Copy(s,4,1)='-' then begin
+ rel:=true;
+ dire:=false;
+ rel2:=true;
+ end;
+ if (rel and not rel1) then begin
+ h:=0;
+ mi:=0;
+ se:=0;
+ end;
+ if rel=true then u:=Copy(s,5,255)
+ else u:=Copy(s,4,255);
+ s:=u;
+ val(copy(s,0,(pos('.',s)-1)),d,t);
+ isok(1);
+ s:=Copy(s,(pos('.',s)+1),255);
+ val(copy(s,0,(pos('.',s)-1)),mo,t);
+ isok(1);
+ s:=Copy(s,(pos('.',s)+1),255);
+ val(s,y,t);
+ isok(1);
+ if not rel then
+ if (y<100) then begin
+ if (y>=80) then y:=y+1900 else y:=y+2000;
+ {Kompatibilitaet zwischen Unix und DOS/Windows}
+ end;
+ if (((d<1) or (d>31)) or ((mo<1) or (mo>12)) or ((y<0) or ((y>99) and ((y<1980) or (y>2107))))) then begin
+ Writeln('Datumsangabe ungueltig'+CR);
+ halt(1);
+ end;
+ dateSet:=true;
+ end;
+ end;
+
begin
{$IFNDEF BP }
{ FreePascal }
@@ -549,8 +603,13 @@
else
begin
{Aktuelle Uhrzeit ermitteln}
+ {$IFNDEF unix}
GetTime(h,mi,se,hund);
Getdate(y,mo,d,dw);
+ {$ELSE}
+ DeCodeDate(date,y,mo,d);
+ DeCodeTime(time,h,mi,se,hund);
+ {$ENDIF}
ref:=false;
{Erstmal nach Sonderparametern suchen ...}
for i:=1 to paramcount do
@@ -561,44 +620,7 @@
s[3]:=UpCase(s[3]);
s[4]:=UpCase(s[4]);
{Parameter gefunden}
- if (copy(s,2,2)='T=') then begin
- {Uhrzeit lesen}
- {/t=hh:mm:ss}
- u:=Copy(s,4,255);
- s:=u;
- val(copy(s,0,(pos(':',s)-1)),h,t);
- isok(2);
- s:=Copy(s,(pos(':',s)+1),255);
- val(copy(s,0,(pos(':',s)-1)),mi,t);
- isok(2);
- s:=Copy(s,(pos(':',s)+1),255);
- val(s,se,t);
- isok(2);
- if (((h<0) or (h>23)) or ((mi<0) or (mi>59)) or ((se<0) or (se>59))) then begin
- writeln('Zeitangabe ungueltig'+CR);
- halt(1);
- end;
- timeSet:=true;
- end;
- if (copy(s,2,2)='D=') then begin
- {Datum lesen}
- {/d=tt.mm.yy}
- u:=Copy(s,4,255);
- s:=u;
- val(copy(s,0,(pos('.',s)-1)),d,t);
- isok(1);
- s:=Copy(s,(pos('.',s)+1),255);
- val(copy(s,0,(pos('.',s)-1)),mo,t);
- isok(1);
- s:=Copy(s,(pos('.',s)+1),255);
- val(s,y,t);
- isok(1);
- if (((d<1) or (d>31)) or ((mo<1) or (mo>12)) or ((y<0) or ((y>99) and ((y<1980) or (y>2107))))) then begin
- Writeln('Datumsangabe ungueltig'+CR);
- halt(1);
- end;
- dateSet:=true;
- end;
+ datetimepar;
{Hidden-Files auch}
if (copy(s,2,1)='H') then files:=files or $02;
{System-Files auch}
@@ -619,21 +641,29 @@
{$ENDIF}
if ((copy(s,2,2)='R=') or (copy(s,2,2)='F=')) then begin
{Referenzdatei}
- filemode:=0;
s:=copy(s,4,255);
reffile:=s;
+ {$IFNDEF unix} {DOS-Refdatei}
+ filemode:=0;
Assign(f,s);
{$I-}
- Reset(f,1);
+ Reset(f);
{$I+}
If Ioresult<>0 then begin
Writeln('Referenzdatei nicht gefunden'+CR);
halt(1);
end;
- GetFTime(f,Ftime);
- ref:=true;
+ GetFTime(f,ftime);
Close(f);
filemode:=2;
+ {$ELSE} {Unix-Refdatei}
+ ftime:=FileAge(reffile);
+ if ftime=-1 then begin
+ Writeln('Referenzdatei nicht gefunden'+CR);
+ halt(1);
+ end;
+ {$ENDIF}
+ ref:=true;
end;
if (copy(s,2,2)='J=') then begin
{Jobfile}
@@ -664,6 +694,7 @@
Readln(s);
end;
end;
+ {$IFNDEF GPLONLY}
if (copy(s,2,3)='MD5') then begin
{MD5-Summen einschalten}
md5b:=true;
@@ -687,6 +718,7 @@
end;
{$ENDIF}
[125 lines skipped]
Mehr Informationen über die CVS-List Mailingliste