

            gfnam$ (6) --- get the pathname for an open file         01/05/83


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 integer function gfnam$ (fd, path, size)
                 file_des fd
                 character path (MAXPATH)
                 integer size

          |      Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 'Gfnam$'  tries to find the name of the open file unit 'fd'.
                 If the unit is a  terminal,  it  returns  the  name  of  the
                 terminal  device.   If  the  unit  is a null device, then it
                 returns the null device  name;  otherwise,  it  obtains  the
                 pathname  and  returns it in 'path'.  If the pathname can be
                 obtained, the length of 'path' is the returned value; other-
                 wise ERR is returned.

                 'Size' is the number of  characters  that  can  be  held  in
                 'path' (including EOS).


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'Gfnam$'  first tries to verify that the file unit for which
                 a name is desired is open and a legal file unit; if it isn't
                 both, then ERR is returned.  Otherwise,  it  checks  to  see
                 what type of file is associated with the given file descrip-
                 tor.   For terminal and null devices, the appropriate device
                 name is returned (device names are of the  form  '/dev/?*').
                 For  disk  files,  the Primos GPATH$ subroutine is called to
                 obtain the Primos treename for  the  file.   If  a  treename
                 could be obtained, then 'mkpa$' is called to generate a Sub-
                 system pathname for the file; otherwise, ERR is returned.


            _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d

                 path


            _C_a_l_l_s

                 ctoc, Primos gpath$, mapsu, mkpa$, ptoc












            gfnam$ (6)                    - 1 -                    gfnam$ (6)


