2 ! PR30005 Enhanced error messages for OPEN
3 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
5 character(25) :: n
= "temptestfile"
7 inquire(file
=n
, exist
=there
)
9 open(77,file
=n
,status
="new")
10 close(77, status
="keep")
13 open(77,file
=n
,status
="new", iomsg
=msg
, iostat
=i
)
14 if (i
== 0) call abort()
15 if (msg
/= "File 'temptestfile' already exists") call abort()
17 open(77,file
=n
,status
="old")
18 close(77, status
="delete")
19 open(77,file
=n
,status
="old", iomsg
=msg
, iostat
=i
)
20 if (i
== 0) call abort()
21 if (msg
/= "File 'temptestfile' does not exist") call abort()
23 open(77,file
="./", iomsg
=msg
, iostat
=i
)
24 if (msg
/= "'./' is a directory" .and
. msg
/= "Invalid argument") call abort()
26 open(77,file
=n
,status
="new")
28 if (i
== 0 .and
. getuid() /= 0) then
29 close(77, status
="keep")
30 open(77,file
=n
, iomsg
=msg
, iostat
=i
, action
="write")
31 if (i
== 0) call abort()
32 if (msg
/= "Permission denied trying to open file 'temptestfile'") call abort()
36 open(77,file
=n
, iomsg
=msg
, iostat
=i
, action
="read")
37 close(77, status
="delete")