tarmakerconsgzip.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. (**
  2. Copyright (c) 2001-2006 by Stefan Heymann
  3. See the file COPYING.DESTRUCTOR, included in this distribution,
  4. for details about the copyright.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. ===============================================================================================
  9. Name : Main
  10. ===============================================================================================
  11. Project : "TarMakerCons" Demo Application for LibTar.pas
  12. ===============================================================================================
  13. Subject : Main Window
  14. ===============================================================================================
  15. Date Author Changes
  16. -----------------------------------------------------------------------------------------------
  17. 2001-06-19 HeySt Start
  18. 2006-10-20 MvdV Fork from GUI version to Console app for
  19. easier testing with FPC on various platforms
  20. 2006-10-21 MvdV Fork again test gzipping.
  21. *)
  22. Program TarMakerConsGZip;
  23. {$ifndef FPC}
  24. Sorry, the zstream unit is afaik FPC only. Maybe it can be gotten
  25. to work with Delphi easily though. See FPC website
  26. {$endif}
  27. Uses SysUtils,Classes,LibTar,zstream;
  28. var p : string;
  29. d : TSearchRec;
  30. TarWriter : TTarWriter;
  31. C : TGZFileStream;
  32. begin
  33. if paramcount<1 then
  34. begin
  35. Writeln('TarMakerCons, compresses *.pas files into a .tar');
  36. writeln('Usage : TarMakerCons <filename to create>');
  37. exit;
  38. end;
  39. C:=TGZFileStream.Create(paramstr(1),gzOpenWrite);
  40. TarWriter := TTarWriter.Create (C);
  41. if FindFirst('*.pas',faAnyFile-faDirectory,d)=0 Then
  42. begin
  43. repeat
  44. TarWriter.AddFile (d.name);
  45. until findnext(d)<>0;
  46. Findclose(d);
  47. end;
  48. TarWriter.free;
  49. c.free;
  50. end.