

            filcpy (2) --- copy a file and its attributes            03/06/82


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 integer function filcpy (from, to)
                 character from (ARB), to (ARB)

                 Library:  vswtlb  (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 'Filcpy'  is  used to copy a file from one place to another,
                 insuring  that  the  copy  possesses  the  same   attributes
                 (protection  keys,  time  of  last  modification, read/write
                 lock, and dumped/modified bits) as the original.

                 The 'from' argument is the pathname of the source file;  the
                 'to' argument is the pathname of the destination.  The func-
                 tion return is OK if the copy succeeded, ERR otherwise.


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'Filcpy'  obtains the 'from' files attributes with a call to
          |      the Primos routine ENT$RD and then opens it with a  call  to
          |      the  Primos routine SRCH$$.  An attempt is then made to open
                 the 'to' file with the same type.  If the attempt fails, the
                 'to' file is removed and  an  error  exit  occurs.   If  the
                 destination  file  is  a  non-empty segment directory, it is
                 then cleaned out with 'rmseg$'.

                 The file is copied by 'cpfil$' or  'cpseg$',  if  it  is  an
                 ordinary  file  or a segment directory, respectively.  If it
                 is ordinary, it is truncated after the copy to  insure  that
                 no old data remains.

                 Several  calls to the Primos routine SATR$$ are then made to
                 set the destination file's attributes.


            _C_a_l_l_s

          |      getto, Primos srch$$, Primos ent$rd, ptoc,  remove,  rmseg$,
                 cpseg$, cpfil$, Primos prwf$$, Primos satr$$


            _S_e_e _A_l_s_o

                 fcopy (2), cp (1)










            filcpy (2)                    - 1 -                    filcpy (2)


