home *** CD-ROM | disk | FTP | other *** search
- ⓪ MODULE CopyMM2;
- ⓪
- ⓪ IMPORT GEMDOSIO; (*$E MOS *)
- ⓪
- ⓪ FROM InOut IMPORT Write, WriteLn, WriteString, WriteInt, Read, ReadString;
- ⓪
- ⓪ FROM Paths IMPORT SearchFile, ListPos;
- ⓪ FROM PathEnv IMPORT HomePath;
- ⓪
- ⓪ FROM ShellMsg IMPORT ShellPath, StdPaths;
- ⓪
- ⓪ FROM Files IMPORT File, Access, Open, Close, Create, State,
- ⓪(replaceOld, GetDateTime, SetDateTime;
- ⓪
- ⓪ FROM MOSGlobals IMPORT Date, Time;
- ⓪
- ⓪ FROM Clock IMPORT PackDate, PackTime;
- ⓪
- ⓪ FROM Binary IMPORT FileSize, WriteBytes, ReadBytes;
- ⓪
- ⓪ FROM Directory IMPORT MakeFullPath, DirQuery, DirEntry,
- ⓪(QueryFiles, QueryAll, subdirAttr, FileAttrSet;
- ⓪
- ⓪ FROM FileNames IMPORT ValidatePath, FilePrefix;
- ⓪
- ⓪ FROM Strings IMPORT String, StrEqual, Append, Assign, Length, Space, Upper,
- ⓪(Concat;
- ⓪
- ⓪ FROM SYSTEM IMPORT ADDRESS, ADR, TSIZE, BYTE, WORD, LONGWORD, ASSEMBLER;
- ⓪
- ⓪ VAR subdirs, ok: BOOLEAN;
- ⓪$res: INTEGER;
- ⓪$fOld, fNew: File;
- ⓪$buf: ARRAY [1..$8000] OF CARDINAL;
- ⓪$line: CARDINAL;
- ⓪
- ⓪ PROCEDURE error (s, m: ARRAY OF CHAR);
- ⓪"VAR ch: CHAR;
- ⓪"BEGIN
- ⓪$WriteLn;
- ⓪$WriteString (s);
- ⓪$Write (' ');
- ⓪$WriteString (m);
- ⓪$Read (ch);
- ⓪"END error;
- ⓪
- ⓪ PROCEDURE checkFile (REF path: ARRAY OF CHAR; entry: DirEntry): BOOLEAN;
- ⓪
- ⓪"VAR old, new: String;
- ⓪&n: LONGCARD;
- ⓪&dat1, dat2: Date;
- ⓪&tim1, tim2: Time;
- ⓪
- ⓪"BEGIN
- ⓪$Concat (path, entry.name, old, ok);
- ⓪$IF subdirAttr IN entry.attr THEN
- ⓪&IF entry.name[0] # '.' THEN
- ⓪(IF StrEqual ('ST_FPU', FilePrefix (entry.name))
- ⓪(OR StrEqual ('TT_FPU', FilePrefix (entry.name))
- ⓪(OR StrEqual ('MAXIDISK', FilePrefix (entry.name))
- ⓪(OR StrEqual ('TEMPLMON', FilePrefix (entry.name)) THEN
- ⓪*(* diese Dateien nicht kopieren *)
- ⓪*WriteLn;
- ⓪*WriteString ('*** Ignoring ');
- ⓪*WriteString (old);
- ⓪*WriteString ('\ ***');
- ⓪*RETURN TRUE
- ⓪(END;
- ⓪(Append ('\*.*', old, ok);
- ⓪(DirQuery (old, QueryAll, checkFile, res);
- ⓪(Close (fOld);
- ⓪(Close (fNew);
- ⓪(IF res < 0 THEN
- ⓪*error (old, "Can't access subdir");
- ⓪(END
- ⓪&END
- ⓪$ELSE
- ⓪&IF StrEqual ('MM2SHELL.M2B', entry.name)
- ⓪&OR StrEqual ('MM2SHELL.M2P', entry.name) THEN
- ⓪((* diese Dateien nicht kopieren *)
- ⓪(WriteLn;
- ⓪(WriteString ('*** Ignoring ');
- ⓪(WriteString (old);
- ⓪(WriteString (' ***');
- ⓪(RETURN TRUE
- ⓪&END;
- ⓪&SearchFile (entry.name, StdPaths, fromStart, ok, new);
- ⓪&IF ok THEN
- ⓪(Open (fOld, old, readOnly);
- ⓪(IF State (fOld) < 0 THEN
- ⓪*error (old, 'Open error');
- ⓪*RETURN TRUE
- ⓪(END;
- ⓪(Open (fNew, new, readOnly);
- ⓪(IF State (fNew) < 0 THEN
- ⓪*error (new, 'Open error');
- ⓪*Close (fOld);
- ⓪*RETURN TRUE
- ⓪(END;
- ⓪(GetDateTime (fOld, dat1, tim1);
- ⓪(GetDateTime (fNew, dat2, tim2);
- ⓪(IF (PackDate (dat1) # PackDate (dat2))
- ⓪(OR (PackTime (tim1) # PackTime (tim2)) THEN
- ⓪*(*
- ⓪+* Datei kopieren
- ⓪+*)
- ⓪*WriteLn;
- ⓪*WriteString ('Update ');
- ⓪*WriteString (old);
- ⓪*WriteString (Space (30-INTEGER(Length(old))));
- ⓪*WriteString (' from ');
- ⓪*WriteString (new);
- ⓪*Close (fOld);
- ⓪*Create (fOld, old, writeOnly, replaceOld);
- ⓪*LOOP
- ⓪,ReadBytes (fNew, ADR (buf), SIZE (buf), n);
- ⓪,IF n=0L THEN EXIT END;
- ⓪,WriteBytes (fOld, ADR (buf), n)
- ⓪*END;
- ⓪*Close (fOld);
- ⓪*Open (fOld, old, writeOnly);
- ⓪*SetDateTime (fOld, dat2, tim2);
- ⓪(END;
- ⓪(Close (fOld);
- ⓪(Close (fNew);
- ⓪&ELSE
- ⓪(error (new, 'Not found!');
- ⓪&END;
- ⓪$END;
- ⓪$RETURN TRUE
- ⓪"END checkFile;
- ⓪
- ⓪ PROCEDURE checkRes (): BOOLEAN;
- ⓪"VAR ch: CHAR;
- ⓪"BEGIN
- ⓪$IF res < 0 THEN
- ⓪&WriteLn;
- ⓪&WriteString ('Error #');
- ⓪&WriteInt (res,0);
- ⓪&WriteLn;
- ⓪&Read (ch);
- ⓪&RETURN TRUE
- ⓪$END;
- ⓪$RETURN FALSE
- ⓪"END checkRes;
- ⓪
- ⓪ VAR n1: String;
- ⓪(ch: CHAR;
- ⓪
- ⓪ BEGIN
- ⓪"HomePath:= ShellPath;
- ⓪"WriteString ('Copy MM2'); WriteLn;
- ⓪"WriteLn;
- ⓪"WriteString ('Updates all files on Disk in A: from same on StdPaths()');
- ⓪"LOOP
- ⓪$WriteLn;
- ⓪$WriteLn;
- ⓪$WriteString ('Insert next Disk and press <Return> (<Esc> to stop)...');
- ⓪$REPEAT
- ⓪&Read (ch);
- ⓪&IF ch = 33C THEN EXIT END;
- ⓪$UNTIL ch = 15C;
- ⓪$WriteLn;
- ⓪$line:= 1;
- ⓪$DirQuery ('A:\*.*', QueryAll, checkFile, res);
- ⓪$Close (fOld);
- ⓪$Close (fNew);
- ⓪$IF checkRes () THEN RETURN END;
- ⓪"END
- ⓪ END CopyMM2.
- ⓪ ə
- (* $FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFECB48C$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54$FFEEBB54Ç$0000056CT.......T.......T.......T.......T.......T.......T.......T.......T.......T.......$FFECB48C$00000233$00000299$0000027D$00000D87$FFF7C6E6$FFF7C6E6$FFF7C6E6$000005D0$000005E6$000005AF$0000059E$000005AD$000007D7$0000056C$0000021D¶Çé*)
-