Commit 3881bdc5 authored by pietrodelugas's avatar pietrodelugas

added optional error flag in output

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13651 c92efa57-630b-4861-b058-cf58834340f0
parent ad2ee26b
......@@ -6,16 +6,18 @@
! or http://www.gnu.org/copyleft/gpl.txt .
!
!--------------------------------------------------------------------------
FUNCTION find_free_unit()
FUNCTION find_free_unit(ierr)
!--------------------------------------------------------------------------
!
IMPLICIT NONE
!
INTEGER :: find_free_unit
INTEGER,OPTIONAL,INTENT(OUT) :: ierr
INTEGER :: iunit
LOGICAL :: opnd
!
!
find_free_unit = -1
unit_loop: DO iunit = 99, 1, -1
!
INQUIRE( UNIT = iunit, OPENED = opnd )
......@@ -30,6 +32,10 @@
!
END DO unit_loop
!
IF ( PRESENT( ierr )) THEN
ierr = 1
RETURN
END IF
CALL errore( 'find_free_unit()', 'free unit not found ?!?', 1 )
!
RETURN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment