2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
18
Task/Unix-ls/Fortran/unix-ls-1.f
Normal file
18
Task/Unix-ls/Fortran/unix-ls-1.f
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
PROGRAM LS !Names the files in the current directory.
|
||||
USE DFLIB !Mysterious library.
|
||||
TYPE(FILE$INFO) INFO !With mysterious content.
|
||||
NAMELIST /HIC/INFO !This enables annotated output.
|
||||
INTEGER MARK,L !Assistants.
|
||||
|
||||
MARK = FILE$FIRST !Starting state.
|
||||
Call for the next file.
|
||||
10 L = GETFILEINFOQQ("*",INFO,MARK) !Mystery routine returns the length of the file name.
|
||||
IF (MARK.EQ.FILE$ERROR) THEN !Or possibly, not.
|
||||
WRITE (6,*) "Error!",L !Something went wrong.
|
||||
WRITE (6,HIC) !Reveal INFO, annotated.
|
||||
STOP "That wasn't nice." !Quite.
|
||||
ELSE IF (IAND(INFO.PERMIT,FILE$DIR) .EQ. 0) THEN !Not a directory.
|
||||
IF (L.GT.0) WRITE (6,*) INFO.NAME(1:L) !The object of the exercise!
|
||||
END IF !So much for that entry.
|
||||
IF (MARK.NE.FILE$LAST) GO TO 10 !Lastness is discovered after the last file is fingered.
|
||||
END !If FILE$LAST is not reached, "system resources may be lost."
|
||||
16
Task/Unix-ls/Fortran/unix-ls-2.f
Normal file
16
Task/Unix-ls/Fortran/unix-ls-2.f
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
INTERFACE
|
||||
INTEGER*4 FUNCTION GETFILEINFOQQ(FILES, BUFFER,dwHANDLE)
|
||||
!DEC$ ATTRIBUTES DEFAULT :: GETFILEINFOQQ
|
||||
CHARACTER*(*) FILES
|
||||
STRUCTURE / FILE$INFO /
|
||||
INTEGER*4 CREATION ! Creation time (-1 on FAT)
|
||||
INTEGER*4 LASTWRITE ! Last write to file
|
||||
INTEGER*4 LASTACCESS ! Last access (-1 on FAT)
|
||||
INTEGER*4 LENGTH ! Length of file
|
||||
INTEGER*2 PERMIT ! File access mode
|
||||
CHARACTER*255 NAME ! File name
|
||||
END STRUCTURE
|
||||
RECORD / FILE$INFO / BUFFER
|
||||
INTEGER*4 dwHANDLE
|
||||
END FUNCTION
|
||||
END INTERFACE
|
||||
Loading…
Add table
Add a link
Reference in a new issue