home *** CD-ROM | disk | FTP | other *** search
-
- {
-
- Simple example file to strip formfeeds in the Terminate manual files
- This is used when upgrading the manuals and you need to strip the old
- formfeeds first. A formfeed is what make the printer change page.
-
- By Bo Bendtsen, free to use or modify by anyone
-
- }
-
- Uses Dos;
- Var
- Info : Searchrec; { FindFirst }
- i,o : Text; { Input,Output files }
- ib,ob : Array[1..4096] of Char; { Fast read/write buffers }
- s : String; { Read string }
- l : longint; { Counter }
- Begin
- WriteLn(#13#10'Strip Formfeeds () from *.HLP');
- WriteLn('──────────────────────────────'#10);
- If Paramcount=0 Then
- Begin
- WriteLn('Syntax : STRIPFF wilcard');
- WriteLn('Example: STRIPFF *.HLP All manual files');
- WriteLn('Example: STRIPFF TERMINAT.HLP One manual file');
- Halt;
- End;
- FindFirst(Paramstr(1),Archive,Info);
- If DosError<>0 Then
- Begin
- WriteLn('No matching files found');
- Halt;
- End;
- While DosError=0 Do { Until no more files }
- Begin
- l:=0;
- Assign(i,info.name);
- WriteLn(info.name);
- Assign(o,'STRIPPER.TXT');
- SetTextbuf(i,ib);
- SetTextbuf(o,ob);
- Reset(i);
- Rewrite(o);
- While Not Eof(i) Do
- begin
- Inc(l);
- Readln(i,s);
- While Pos('',s)<>0 Do { Remove formfeeds }
- Begin
- WriteLn('Line ',l:5,' ',s);
- Delete(s,pos('',s),1);
- End;
- Writeln(o,s);
- end;
- Close(i);
- Close(o);
- Writeln('────────────');
- Erase(i);
- Rename(o,info.name);
- Findnext(info);
- End;
- End.