      subroutine dirnam (prompt, defalt, direct, lendir)

      character*(*) prompt, defalt, direct
      integer*2 lendir

c get directory name
c called by GETROT

      character*80 mesage
      character*1 seprate
      parameter (seprate='/')

      if (lendir .eq. 0) then
        lenmes = 0
        call append (' ', mesage, lenmes)
        call append (prompt, mesage, lenmes)
        call append (' [', mesage, lenmes)
        call append (defalt, mesage, lenmes)
        call append ('] : ', mesage, lenmes)
        call caryon (mesage(:lenmes), direct)
        if (len_trim(direct) .eq. 0) direct = defalt
        lendir = len_trim(direct)
      end if
      if (direct(lendir:lendir) .ne. seprate) then
        call append (seprate, direct, int(lendir))
      end if
      return
      end
