home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / 0151ter2.zip / 0151TER2._XE / rar / PASCAL.EXE / STRIPFF.PAS < prev    next >
Pascal/Delphi Source File  |  1994-09-22  |  2KB  |  63 lines

  1.  
  2. {
  3.  
  4. Simple example file to strip formfeeds in the Terminate manual files
  5. This is used when upgrading the manuals and you need to strip the old
  6. formfeeds first. A formfeed is what make the printer change page.
  7.  
  8. By Bo Bendtsen, free to use or modify by anyone
  9.  
  10. }
  11.  
  12. Uses Dos;
  13. Var
  14.   Info  : Searchrec;                            { FindFirst }
  15.   i,o   : Text;                                 { Input,Output files }
  16.   ib,ob : Array[1..4096] of Char;               { Fast read/write buffers }
  17.   s     : String;                               { Read string }
  18.   l     : longint;                              { Counter }
  19. Begin
  20.   WriteLn(#13#10'Strip Formfeeds ( ) from *.HLP');
  21.   WriteLn('──────────────────────────────'#10);
  22.   If Paramcount=0 Then
  23.   Begin
  24.     WriteLn('Syntax : STRIPFF wilcard');
  25.     WriteLn('Example: STRIPFF *.HLP          All manual files');
  26.     WriteLn('Example: STRIPFF TERMINAT.HLP   One manual file');
  27.     Halt;
  28.   End;
  29.   FindFirst(Paramstr(1),Archive,Info);
  30.   If DosError<>0 Then
  31.   Begin
  32.     WriteLn('No matching files found');
  33.     Halt;
  34.   End;
  35.   While DosError=0 Do                                  { Until no more files }
  36.   Begin
  37.     l:=0;
  38.     Assign(i,info.name);
  39.     WriteLn(info.name);
  40.     Assign(o,'STRIPPER.TXT');
  41.     SetTextbuf(i,ib);
  42.     SetTextbuf(o,ob);
  43.     Reset(i);
  44.     Rewrite(o);
  45.     While Not Eof(i) Do
  46.     begin
  47.       Inc(l);
  48.       Readln(i,s);
  49.       While Pos(' ',s)<>0 Do                           { Remove formfeeds }
  50.       Begin
  51.         WriteLn('Line ',l:5,'  ',s);
  52.         Delete(s,pos(' ',s),1);
  53.       End;
  54.       Writeln(o,s);
  55.     end;
  56.     Close(i);
  57.     Close(o);
  58.     Writeln('────────────');
  59.     Erase(i);
  60.     Rename(o,info.name);
  61.     Findnext(info);
  62.   End;
  63. End.