program FITSless implicit none integer :: status ! status ... FITS status (0=no error) integer :: j,blocksize character(len=666) :: name = 'image.fits' ! name .. fill with name of the image to open character(len=666) :: keyword ! keyword to print the record character(len=666) :: record ! header's record character(len=666) :: value, comment ! record's value & comment integer :: nhead, hpos ! number of records in header and current position ! get first command line parameter call get_command_argument(1, keyword) status = 0 call ftopen(25,name,0,blocksize,status) if( status /= 0 ) stop 'File not found.' ! list specified keyword or full header if( keyword /= ' ' ) then write(*,*) 'List of a record specified by your keyword:' write(*,*) '-------------------------------------------' call ftgkys(25,keyword,value, comment, status) ! checking status of the operation if( status == 0 ) then write(*,*) trim(keyword),' = ',trim(value),' /',trim(comment) else write(*,*) 'Keyword "',trim(keyword),'" not found.' end if else write(*,*) 'Full header list:' write(*,*) '-----------------' call ftghps(25,nhead,hpos,status) do j = 1, nhead call ftgrec(25,j,record,status) write(*,*) trim(record) enddo end if call ftclos(25,status) end program FITSless