tem_connect_toNull Subroutine

public subroutine tem_connect_toNull(null_unit)

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: null_unit

Source Code

  subroutine tem_connect_toNull(null_unit)
    integer, intent(out) :: null_unit

    logical :: null_connected

    inquire(file=trim(null_device), opened=null_connected)
    if (null_connected) then
      inquire(file=trim(null_device), number=null_unit)
      ! Some MPI implementations might connect stdin to the null device.
      ! Need to check if this is the case and attempt to open it again
      ! with a different unit to make it writable.
      if (null_unit == input_unit) then
        null_unit = newUnit()
        open(file=trim(null_device), unit=null_unit)
      end if
    else
      null_unit = newUnit()
      open(file=trim(null_device), unit=null_unit)
    end if

  end subroutine tem_connect_toNull