; .comp eis_study_duration.pro
; .comp eis_study_time.pro

pro screen_output, fname, start_time, end_time, st_ac, ra_ac, sid, rid, sd
    print, format='(A27," ",I03," ",Z02," ",I05," ",Z04," ",2(A20),2(A29),A16)', $
      fname, sid, sid, rid, rid, st_ac, ra_ac, start_time, end_time, sd
end

pro log_output, lu, fname, start_time, end_time, st_ac, ra_ac, sid, rid, sd
    printf, lu, format='(A27," ",I03," ",Z02," ",I05," ",Z04," ",2(A20),2(A29),A16)', $
      fname, sid, sid, rid, rid, st_ac, ra_ac, start_time, end_time, sd
end

; No check whether file is a fits file or not
pro eis_read_slist, file=in_file

    if n_elements(in_file) ne 0 then begin
        in_files = findfile(in_file, count=count)
        if count eq 0 then begin
            print, 'Cant find the file'
            return
        endif
    endif

    for i = 0, count - 1 do begin
        parts = str_sep(in_files[i], '/')
        pfname = parts[n_elements(parts)-1]

        openr, lu, in_files[i], /get_lun
;        readf, lu, format='(A27,I03,Z02,I05,Z04,2(A20),2(A29),A16)', $
;          fname, seqd, seqh, ridd, ridh, st_ac, ra_ac, date_obs, date_end, sd
;
;        screen_output, fname, date_obs, date_end, st_ac, ra_ac, seqd, ridd, sd
        line = ''
        readf, lu, line
        print,line
        split = str_sep(line,'\')
        help,split
        print,split

        close,lu
        free_lun,lu

    endfor

end
