! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

! Example 8.6. (Fortran 90 version.) Link new item to actual pointer.
  program I06
    use I06M
    implicit none
    type (Box_Type), pointer :: Root_BP, Temp_BP
    character (len = S_LEN) :: New_Name
! start program I06
    open (unit = 1, file = "i06.txt", status = "old", action = "read", position = "rewind")
    nullify( Root_BP )
    do
      read (unit = 1, fmt = *) New_Name
      if (New_Name == "") then
        exit
      end if
      call Look_Up( Root_BP, New_Name )
    end do
    Temp_BP => Root_BP
    do
      if (.not. associated( Temp_BP )) then
        exit
      end if
      write (unit = *, fmt = *) Temp_BP % Name
      Temp_BP => Temp_BP % Next_BP
    end do
    stop
  end program I06
