Skip to content

No error control parsing boolean values #9

@victorsndvg

Description

@victorsndvg

Hello Stefano,

I was checking some features of FLAP and it's a great tool, i'm sure that will be useful for us :)

Through flap_test, I have seen that in some lines when a logical is expected by FLAP there is no error handling. For example if you runl flap_test with the following arguments an error arises:

$ flap_test/FLAP_TEST -s 'asdf' --boolean_val 0
+--> flap_test, a testing program for FLAP library
+--> Parsing Command Line Arguments
forrtl: severe (59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
...
FLAP_TEST 0000000000411D54 data_type_command 289 ...
...

The error references the following line:
https://github.com/szaghi/FLAP/blob/master/src/Data_Type_Command_Line_Interface.f90#L289

A proposal to handle this error might be to replace that line with:

   read(cla%val,*,iostat=error)val
   if(error) write(stderr,'(A)')prefd//' Error: cannot convert "'// &
                  trim(adjustl(cla%val))//'" of CLA "'//cla%switch//'" to boolean.'

Maybe you will find this change useful.

Best regards,
Víctor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions