home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / MM2_DEV / S / MYUTIL / COPYMM2.OLD < prev    next >
Encoding:
Text File  |  1990-11-09  |  4.4 KB  |  3 lines

  1. ⓪ MODULE CopyMM2;
  2. ⓪ 
  3. ⓪ IMPORT GEMDOSIO; (*$E MOS *)
  4. ⓪ 
  5. ⓪ FROM InOut IMPORT Write, WriteLn, WriteString, WriteInt, Read, ReadString;
  6. ⓪ 
  7. ⓪ FROM Paths IMPORT SearchFile, ListPos;
  8. ⓪ FROM PathEnv IMPORT HomePath;
  9. ⓪ 
  10. ⓪ FROM ShellMsg IMPORT ShellPath, StdPaths;
  11. ⓪ 
  12. ⓪ FROM Files IMPORT File, Access, Open, Close, Create, State,
  13. ⓪(replaceOld, GetDateTime, SetDateTime;
  14. ⓪ 
  15. ⓪ FROM MOSGlobals IMPORT Date, Time;
  16. ⓪ 
  17. ⓪ FROM Clock IMPORT PackDate, PackTime;
  18. ⓪ 
  19. ⓪ FROM Binary IMPORT FileSize, WriteBytes, ReadBytes;
  20. ⓪ 
  21. ⓪ FROM Directory IMPORT MakeFullPath, DirQuery, DirEntry,
  22. ⓪(QueryFiles, QueryAll, subdirAttr, FileAttrSet;
  23. ⓪ 
  24. ⓪ FROM FileNames IMPORT ValidatePath, FilePrefix;
  25. ⓪ 
  26. ⓪ FROM Strings IMPORT String, StrEqual, Append, Assign, Length, Space, Upper,
  27. ⓪(Concat;
  28. ⓪ 
  29. ⓪ FROM SYSTEM IMPORT ADDRESS, ADR, TSIZE, BYTE, WORD, LONGWORD, ASSEMBLER;
  30. ⓪ 
  31. ⓪ VAR subdirs, ok: BOOLEAN;
  32. ⓪$res: INTEGER;
  33. ⓪$fOld, fNew: File;
  34. ⓪$buf: ARRAY [1..$8000] OF CARDINAL;
  35. ⓪$line: CARDINAL;
  36. ⓪ 
  37. ⓪ PROCEDURE error (s, m: ARRAY OF CHAR);
  38. ⓪"VAR ch: CHAR;
  39. ⓪"BEGIN
  40. ⓪$WriteLn;
  41. ⓪$WriteString (s);
  42. ⓪$Write (' ');
  43. ⓪$WriteString (m);
  44. ⓪$Read (ch);
  45. ⓪"END error;
  46. ⓪ 
  47. ⓪ PROCEDURE checkFile (REF path: ARRAY OF CHAR; entry: DirEntry): BOOLEAN;
  48. ⓪ 
  49. ⓪"VAR old, new: String;
  50. ⓪&n: LONGCARD;
  51. ⓪&dat1, dat2: Date;
  52. ⓪&tim1, tim2: Time;
  53. ⓪ 
  54. ⓪"BEGIN
  55. ⓪$Concat (path, entry.name, old, ok);
  56. ⓪$IF subdirAttr IN entry.attr THEN
  57. ⓪&IF entry.name[0] # '.' THEN
  58. ⓪(IF StrEqual ('ST_FPU', FilePrefix (entry.name))
  59. ⓪(OR StrEqual ('TT_FPU', FilePrefix (entry.name))
  60. ⓪(OR StrEqual ('MAXIDISK', FilePrefix (entry.name))
  61. ⓪(OR StrEqual ('TEMPLMON', FilePrefix (entry.name)) THEN
  62. ⓪*(* diese Dateien nicht kopieren *)
  63. ⓪*WriteLn;
  64. ⓪*WriteString ('*** Ignoring ');
  65. ⓪*WriteString (old);
  66. ⓪*WriteString ('\ ***');
  67. ⓪*RETURN TRUE
  68. ⓪(END;
  69. ⓪(Append ('\*.*', old, ok);
  70. ⓪(DirQuery (old, QueryAll, checkFile, res);
  71. ⓪(Close (fOld);
  72. ⓪(Close (fNew);
  73. ⓪(IF res < 0 THEN
  74. ⓪*error (old, "Can't access subdir");
  75. ⓪(END
  76. ⓪&END
  77. ⓪$ELSE
  78. ⓪&IF StrEqual ('MM2SHELL.M2B', entry.name)
  79. ⓪&OR StrEqual ('MM2SHELL.M2P', entry.name) THEN
  80. ⓪((* diese Dateien nicht kopieren *)
  81. ⓪(WriteLn;
  82. ⓪(WriteString ('*** Ignoring ');
  83. ⓪(WriteString (old);
  84. ⓪(WriteString (' ***');
  85. ⓪(RETURN TRUE
  86. ⓪&END;
  87. ⓪&SearchFile (entry.name, StdPaths, fromStart, ok, new);
  88. ⓪&IF ok THEN
  89. ⓪(Open (fOld, old, readOnly);
  90. ⓪(IF State (fOld) < 0 THEN
  91. ⓪*error (old, 'Open error');
  92. ⓪*RETURN TRUE
  93. ⓪(END;
  94. ⓪(Open (fNew, new, readOnly);
  95. ⓪(IF State (fNew) < 0 THEN
  96. ⓪*error (new, 'Open error');
  97. ⓪*Close (fOld);
  98. ⓪*RETURN TRUE
  99. ⓪(END;
  100. ⓪(GetDateTime (fOld, dat1, tim1);
  101. ⓪(GetDateTime (fNew, dat2, tim2);
  102. ⓪(IF (PackDate (dat1) # PackDate (dat2))
  103. ⓪(OR (PackTime (tim1) # PackTime (tim2)) THEN
  104. ⓪*(*
  105. ⓪+* Datei kopieren
  106. ⓪+*)
  107. ⓪*WriteLn;
  108. ⓪*WriteString ('Update ');
  109. ⓪*WriteString (old);
  110. ⓪*WriteString (Space (30-INTEGER(Length(old))));
  111. ⓪*WriteString (' from ');
  112. ⓪*WriteString (new);
  113. ⓪*Close (fOld);
  114. ⓪*Create (fOld, old, writeOnly, replaceOld);
  115. ⓪*LOOP
  116. ⓪,ReadBytes (fNew, ADR (buf), SIZE (buf), n);
  117. ⓪,IF n=0L THEN EXIT END;
  118. ⓪,WriteBytes (fOld, ADR (buf), n)
  119. ⓪*END;
  120. ⓪*Close (fOld);
  121. ⓪*Open (fOld, old, writeOnly);
  122. ⓪*SetDateTime (fOld, dat2, tim2);
  123. ⓪(END;
  124. ⓪(Close (fOld);
  125. ⓪(Close (fNew);
  126. ⓪&ELSE
  127. ⓪(error (new, 'Not found!');
  128. ⓪&END;
  129. ⓪$END;
  130. ⓪$RETURN TRUE
  131. ⓪"END checkFile;
  132. ⓪ 
  133. ⓪ PROCEDURE checkRes (): BOOLEAN;
  134. ⓪"VAR ch: CHAR;
  135. ⓪"BEGIN
  136. ⓪$IF res < 0 THEN
  137. ⓪&WriteLn;
  138. ⓪&WriteString ('Error #');
  139. ⓪&WriteInt (res,0);
  140. ⓪&WriteLn;
  141. ⓪&Read (ch);
  142. ⓪&RETURN TRUE
  143. ⓪$END;
  144. ⓪$RETURN FALSE
  145. ⓪"END checkRes;
  146. ⓪ 
  147. ⓪ VAR     n1: String;
  148. ⓪(ch: CHAR;
  149. ⓪ 
  150. ⓪ BEGIN
  151. ⓪"HomePath:= ShellPath;
  152. ⓪"WriteString ('Copy MM2'); WriteLn;
  153. ⓪"WriteLn;
  154. ⓪"WriteString ('Updates all files on Disk in A: from same on StdPaths()');
  155. ⓪"LOOP
  156. ⓪$WriteLn;
  157. ⓪$WriteLn;
  158. ⓪$WriteString ('Insert next Disk and press <Return> (<Esc> to stop)...');
  159. ⓪$REPEAT
  160. ⓪&Read (ch);
  161. ⓪&IF ch = 33C THEN EXIT END;
  162. ⓪$UNTIL ch = 15C;
  163. ⓪$WriteLn;
  164. ⓪$line:= 1;
  165. ⓪$DirQuery ('A:\*.*', QueryAll, checkFile, res);
  166. ⓪$Close (fOld);
  167. ⓪$Close (fNew);
  168. ⓪$IF checkRes () THEN RETURN END;
  169. ⓪"END
  170. ⓪ END CopyMM2.
  171. ⓪ ə
  172. (* $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¶Çé*)
  173.