public function my_status_string(key, info) result(val)
This function returns the string in the line which starts with the
specified key string in the text returned from print_self_status.
The key string itself is excluded from the returned string.
If the specified key is not found in the text an empty string will be
returned.
info can be used to change the input that should be read, it defaults to
'/proc/self/status'.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
function my_status_string(key,info)result(val)! ---------------------------------------------------------------------------character(len=*),intent(in)::key!< Case sensitive!character(len=*),intent(in),optional::infocharacter(len=80)::val! ---------------------------------------------------------------------------integer::scratchUnitcharacter(len=80)::buflineinteger::iosinteger::keylenlogical::match! ---------------------------------------------------------------------------scratchUnit=newUnit()val=''keylen=len_trim(key)open(unit=scratchUnit,status='scratch')call print_self_status(scratchUnit,info=info)rewind(scratchUnit)read(scratchUnit,'(a)',iostat=ios)buflinematch=(bufline(1:keylen)==trim(key))do while((ios==0).and.(.not.match))read(scratchUnit,'(a)',iostat=ios)buflinematch=(bufline(1:keylen)==trim(key))end do close(scratchUnit)if(match)val=trim(bufline(len_trim(key)+1:))val=adjustl(val)end function my_status_string