fixlog.pp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Peter Vreman
  4. Remove all revision logs from source files after X revisions or
  5. older than date X
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. program fixlog;
  13. {$mode objfpc}
  14. {$H+}
  15. uses
  16. sysutils;
  17. const
  18. bufsize = 32*1024;
  19. var
  20. maxrevs,myear,mmonth,mday : integer;
  21. procedure Date2Int(const date:string;var year,month,day:integer);
  22. begin
  23. year:=StrToInt(Copy(date,1,4));
  24. month:=StrToInt(Copy(date,6,2));
  25. day:=StrToInt(Copy(date,9,2));
  26. if (year=0) or (month=0) or (day=0) then
  27. begin
  28. writeln('wrong date "',date,'", use yyyy/mm/dd');
  29. halt(2);
  30. end;
  31. end;
  32. procedure dofile(const fn:string);
  33. var
  34. t,f : text;
  35. s : string;
  36. skip : boolean;
  37. year,month,day,
  38. found,revs,i : integer;
  39. fbuf,tbuf : pointer;
  40. begin
  41. getmem(fbuf,bufsize);
  42. getmem(tbuf,bufsize);
  43. write('processing ',fn,': ');
  44. assign(t,fn);
  45. assign(f,'fixlog.tmp');
  46. {$I-}
  47. reset(t);
  48. {$I+}
  49. if ioresult<>0 then
  50. begin
  51. writeln('error!');
  52. exit;
  53. end;
  54. rewrite(f);
  55. settextbuf(t,tbuf^,bufsize);
  56. settextbuf(f,fbuf^,bufsize);
  57. found:=0;
  58. revs:=0;
  59. skip:=false;
  60. while not eof(t) do
  61. begin
  62. readln(t,s);
  63. case found of
  64. 0 :
  65. begin
  66. $Log$
  67. Revision 1.2 2000-07-13 11:32:55 michael
  68. + removed logs
  69. }