NBPrg40. (*Ext_source). (**EDSFILE). EDSFILE.PAS. MiniOS. OpenSource.

NBPrg40. (*Ext_source). (**EDSFILE). EDSFILE.PAS. MiniOS. OpenSource.
***************************************

{ Nikita Beloshenko (GNU) 2013 }

Unit EDSFILE;

(*

   EDSFILE.PAS

   +---------------------------+ 
   |                           | 
   |      E D S F I L E        | 
   |                           | 
   +---------------------------+ *)

Interface

Procedure Edit_S_FILE_run;

Implementation

{ Edit File (With Search) }
Procedure Edit_S_FILE_run;
Label
  START;
Var
  Name,S : String;
  Search : String;
  S1     : String;
  T,T1   : Text;
  N_STE  : Integer;

Begin

START :

  WriteLn(' +---------------------------+ ');
  WriteLn(' |                           | ');
  WriteLn(' |      E D S F I L E        | ');
  WriteLn(' |                           | ');
  WriteLn(' +---------------------------+ ');
  WriteLn('                               ');
  WriteLn(' Nikita Beloshenko (GNU) 2013 ');
  WriteLn(' ----- File->(Edit) 2013 {(text) (module)} ----- ');
  WriteLn(' ----- Edit with search. ----- ');

  WriteLn(' ');

  WriteLn(' Name? ');

  ReadLn(Name);

  WriteLn(' String to search?->- ');
  ReadLn(Search);

  Assign(T,Name);
  Reset(T);

  Assign(T1,'EDBuf.tmp');
  ReWrite(T1);

  N_STE := 0;

  While Not eof(T) Do
  Begin
    ReadLn(T,S);
    WriteLn(S);
    If (Pos(Search,S)<>0) Then
    Begin
      WriteLn('N_STE?(strings to edit)');
      ReadLn(N_STE);
    End;
    If (N_STE>0) Then
    Begin
      Dec(N_STE);
      S1 := '';
      While ((S1<>'y') And (S1<>'n')) Do
      Begin
        WriteLn('----- ?(new string)?>y/n -----');
        ReadLn(S1);
      End;
      If S1='y' Then
      Begin
        WriteLn('----- ?(new string)?> -----');
        ReadLn(S);
      End;
    End;
    WriteLn(T1,S);
  End;

  Close(T1);

  Close(T);

  { REWRITE }

  Assign(T,Name);
  ReWrite(T);

  Assign(T1,'EDBuf.tmp');
  Reset(T1);

  While Not eof(T1) Do
  Begin
    ReadLn(T1,S);
    WriteLn(T,S);
  End;

  Close(T1);

  Close(T);

  { GOTO START ? }

  S := '';

  While ((S<>'y') And (S<>'n')) Do
  Begin
    WriteLn(' ----- GOTO START? (Another File) ----- ');
    WriteLn('y/n');
    ReadLn(S);
  End;

  If S='y' Then Goto START;

End;

End.