DEFINITION MODULE RENAME;

(* AUTHOR: Steve Cohen
   September 14, 1987.

   A workaround for a bug in the Rename PROCEUDRE in Turbo-Modula-2's
   FILES MODULE.  TM2's Rename overwrites something in the FILES
   module with unpredictable results.

   This module adopts the philosophy of not reinventing the wheel.
   Wherever possible it uses code from the FILES module to accomplish
   parsing and other necessary functions, even at the cost of extra
   operations, recognizing that file renaming is not something that
   most programs will do very often.  In short, a quick and dirty fix. *)

FROM FILES IMPORT FILE;

PROCEDURE Rename(VAR F: FILE; Name: ARRAY OF CHAR);

(* On input F is an OPEN File.  As with the TM2 Rename PROCEDURE,
   F is closed as a side effect of this procedure.  It must be 
   reopened under the new name to be reaccessed.  Also note that the
   new name must not be the name of an existing file or the rename will 
   not take place.  No indication is given; it is the programmer's
   responsibility to determine if a file name is "free" before this 
   procedure is called. *)
   
END RENAME.
grammer's
   responsibility to determine if a file name is "free" before this 
   procedure is called. *)
   
END RENAME.
