home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / pibsoft / terminal / source / rewrited.mod < prev    next >
Encoding:
Text File  |  1988-02-07  |  2.9 KB  |  88 lines

  1. (*----------------------------------------------------------------------*)
  2. (*        Rewrite_Dialing_Directory --- Rewrite dialing directory       *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Rewrite_Dialing_Directory;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Rewrite_Dialing_Directory                            *)
  10. (*                                                                      *)
  11. (*     Purpose:    Rewrites the dialing directory                       *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Rewrite_Dialing_Directory;                                    *)
  16. (*                                                                      *)
  17. (*     Remarks:                                                         *)
  18. (*                                                                      *)
  19. (*        Watch out -- some tricky stuff with string data and lengths   *)
  20. (*        is used here.                                                 *)
  21. (*                                                                      *)
  22. (*----------------------------------------------------------------------*)
  23.  
  24. VAR
  25.    I         : INTEGER;
  26.    Ierr      : INTEGER;
  27.    F         : TEXT;
  28.    Phone_Str : AnyStr;
  29.    Phone_Name: AnyStr;
  30.    Full_Name : AnyStr;
  31.  
  32. BEGIN (* Rewrite_Dialing_Directory *)
  33.  
  34.                                    (* Don't update non-existent directory! *)
  35.  
  36.    IF ( Dialing_Directory = NIL ) THEN EXIT;
  37.  
  38.    Add_Path( Dialing_File_Name, Home_Dir, Full_Name );
  39.  
  40.    WRITELN;
  41.    ClrEol;
  42.  
  43.    WRITE('Rewriting updated phone directory to ',Dialing_File_Name);
  44.    ClrEol;
  45.    WRITELN;
  46.  
  47.    ASSIGN    ( F , Full_Name );
  48.    SetTextBuf( F , Sector_Data );
  49.    REWRITE   ( F );
  50.  
  51.    IF ( INT24Result = 0 ) THEN
  52.       BEGIN
  53.  
  54.          Phone_Str[0] := CHR( Dialing_Dir_Entry_Length );
  55.  
  56.          FOR I := 1 TO Dialing_Dir_Size DO
  57.             BEGIN
  58.                MOVE( Dialing_Directory^[I], Phone_Str[1],
  59.                      Dialing_Dir_Entry_Length  );
  60.                WRITELN( F, Phone_Str );
  61.                Ierr := Int24Result;
  62.             END;
  63.  
  64.          CLOSE( F );
  65.          Ierr := Int24Result;
  66.  
  67.          Any_Dialing_Changes := FALSE;
  68.  
  69.          WRITELN;
  70.          ClrEol;
  71.  
  72.          WRITE('Phone directory ',Dialing_File_Name,' updated.');
  73.          ClrEol;
  74.          WRITELN;
  75.  
  76.       END
  77.    ELSE
  78.       BEGIN
  79.          WRITELN;
  80.          ClrEol;
  81.          WRITE('Can''t update phone directory ',Full_Name);
  82.          ClrEol;
  83.       END;
  84.  
  85.    Window_Delay;
  86.  
  87. END   (* Rewrite_Dialing_Directory *);
  88.