home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PARADIS1 / ARJHEAD2.PAS < prev    next >
Pascal/Delphi Source File  |  1992-03-27  |  3KB  |  118 lines

  1. (5254)  Sat 21 Mar 92  0:45
  2. By: Darren Lyon
  3. To: All
  4. Re: ArjDate (3/4)
  5. St:
  6. ---------------------------------------------------------------------------
  7. @EID:16fd 187505a0
  8. @MSGID: 3:690/660.4 176eba07
  9. { See if there is a dot ('.') in the passed string (or filename) }
  10. Function CheckDot(Name : String) : Boolean;
  11.  
  12. var Loop  : Integer;
  13.     Found : Boolean;
  14.  
  15. begin
  16.  
  17.    { Start of assuming there isn't }
  18.    Found := False;
  19.  
  20.    for Loop:=1 to Length(Name) do
  21.       if Name[Loop]='.' then
  22.          Found := True;          { Found one, so set to True }
  23.  
  24.    CheckDot := Found;            { Assign our result as the return value }
  25.  
  26. End;
  27.  
  28. { Start of the main code }
  29.  
  30. Begin
  31.  
  32.    { Pretty intro... }
  33.    Writeln('ARJDATE, .ARJ file time stamping utility');
  34.    Writeln('Copyright (C) 1992, by Darren Lyon');
  35.    Writeln;
  36.  
  37.    { see if they passed only one parameter }
  38.    if Paramcount <> 1 then
  39.       Begin
  40.       { Tell them how to use the program }
  41.       Write('Error: You must specify the name of ');
  42.       Writeln('the archive on the command line!');
  43.       Writeln('       Wildcards are allowed.');
  44.       Writeln;
  45.       Writeln('Examples:   ArjDate Test.Arj');
  46.       Writeln('            ArjDate T*.Arj');
  47.       Halt;
  48.       End;
  49.  
  50.    { Disable IO checking, so that WE trap errors and not DOS }
  51.    {$I-}
  52.  
  53.    { If ther is no extension, assume ARJ as the default }
  54.    if CheckDot(Paramstr(1))=False then
  55.       FileTitle := Paramstr(1)+'.ARJ'
  56.    else
  57.       FileTitle := Paramstr(1);
  58.  
  59.    { Find the first file matching the name, as a starting point }
  60.    FindFirst(FileTitle, Archive, DirInfo);
  61.  
  62.    { See if ANY files match }
  63.    if DosError<>0 then
  64.       { Tell them they specified a bogus parameter }
  65.       Begin
  66.       Write('Error: There was a problem handling ''');
  67.       PrintUpper(FileTitle);
  68.       Writeln(''', please rectify!');
  69.       Halt;
  70.       end;
  71.  
  72.    { Until we find no matching files, repeat this... }
  73.    While DosError = 0 do
  74.       Begin
  75.  
  76.       { Extract the name of the matching file }
  77.       FileName := DirInfo.Name;
  78.  
  79.       { Open the file }
  80.       Assign(ArjFile, FileName);
  81.       Reset(ArjFile, 1);
  82.       if IOResult<>0 then
  83.          Begin
  84.          { Tell them there is a problem with this file }
  85.          {$I+}
  86.          write('Error: There was a problem accessing ''');
  87.          printupper(FileName);
  88.          writeln(''', please rectify!');
  89.          halt;
  90.          end;
  91.  
  92.       { Initialize some of our variables }
  93.       FileCount := 0;
  94.       TopDate := 0;
  95.  
  96.       { Specify the division between this and the last file (or the title) }
  97.       Writeln('-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
  98.  -  -  -  -  -');
  99.       Writeln('Archive name: ', FileName);
  100.  
  101.       { Read the header and make sure this is an Arj archive }
  102.       BlockRead(ArjFile, Sig, SizeOf(Sig));
  103.       if (IOResult<>0) or (Sig.MagicNumber<>$EA60) then
  104.          writeln('Error in archive, or not and ARJ archive')
  105.       else
  106.          { Otherwise, proceed through the file }
  107.          begin
  108.  
  109.          { Read of the main file header, and discard }
  110.          BlockRead(ArjFile, Hdr, SizeOf(Hdr), BytesRead);
  111.  
  112.  
  113. --- msgedsq 2.0.5
  114.  * Origin: Programming - the art of re-inventing wheels! (3:690/660.4)
  115.  
  116. @PATH: 6600/4 690/660 601 644 640/821 209/209 396/1 170/400 512/0 
  117. @PATH: 512/1007 
  118.